焦点滚动时随机跳跃 [英] Focus randomly jumps when scrolling

查看:121
本文介绍了焦点滚动时随机跳跃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有许多的EditText 控制和在他们附近复选框的活动。默认情况下,大多数 EditTexts 被禁用。

I have an activity with many EditText controls and checkboxes near them. By default, most EditTexts are disabled.

当我打开活动,一些随机的EditText 控件获得焦点(周围框),如果你点击它,在屏幕上的键盘会出现,即使的EditText 被禁用,不显示任何文本时preSS屏幕上的按键。

When I open the activity, some random EditText control gets focus (a frame around it) and if you tap on it, the on-screen keyboard appears even though the EditText is disabled and no text appears when you press the on-screen keys.

另外,我的整个布局是包裹在一个滚动型。滚动时,一些随机的EditText 取值获得焦点。它可以是最低的一个可见,或最高可见,或有时一个在中间,有时一个可见区域之外。

Also, my whole layout is wrapped in a ScrollView. When you scroll, some random EditTexts get focus. It can be the lowest visible one, or the highest visible, or sometimes one in the middle, sometimes one outside the visible area.

由于布局的随机元素获得焦点,该活动被随机地向下滚动,当你打开它,这是pretty的讨厌。

Because a random element of the layout gets focus, the Activity gets randomly scrolled down when you open it, which is pretty annoying.

我想这是一个Android的错误,但有一个解决办法?

I guess it's an Android's bug, but is there a workaround?

<一个href="http://stackoverflow.com/questions/1555109/stop-edittext-from-gaining-focus-at-activity-startup">Stop从的EditText在活动启动获得焦点处理的情况,只有1 的EditText ,而您可以告诉失去焦点,使假人的元素可能获得它。在我的情况下,虚拟元素不获得焦点,无论是在onResume或的onCreate,既机器人:可调焦=真正的机器人:focusableInTouchMode =真正的

Stop EditText from gaining focus at Activity startup handles the situation with only 1 EditText for which you can tell to lose focus so that the dummy element could gain it. In my case the dummy element doesn't gain focus, both in onResume or onCreate, with both android:focusable="true" android:focusableInTouchMode="true"

我应该检查所有的EditText控件(还有他们的12),并告诉他们失去焦点?什么跟滚动,因为它似乎集中随机跳跃。

Should I check all the EditText controls (there are 12 of them) and tell them to lose focus? What with scrolling, because it seems focus randomly jumps.

推荐答案

这不是滚动,它随机聚焦的EditText。这是当滚动视图处理一扔事件。如果覆盖了一扔方法不会有任何随机的焦点更改。

It's not scrolling that randomly focuses the EditText. It's when the scrollview handles a fling event. If you overwrite the fling method the won't be any random focus changes.

这时如果你想一扔功能回到你需要编写自己一扔方法。有code在这里您可以复制:

Then if you want the fling functionality back you'll need to write your own fling method. There's code here you can copy from:

平滑滚动在Android的

这篇关于焦点滚动时随机跳跃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆