Android“tabindex”
我有几个 LinearLayouts 包含在它们各自的 ScrollView 中,而这些 ScrollView 又包含在 ViewFlipper 中。奇怪的是,在某些布局中,一旦获得焦点,它就会自动在顶部以外的位置启动。
那么是什么原因导致这种情况呢?为了强制它们从顶部开始,html中是否有类似 tabindex 属性的东西?
谢谢
I have several LinearLayouts contained inside their respective ScrollView which in turn are contained by a ViewFlipper. The odd stuff is that in some of the Layouts once they have the focus, it starts automatically in a place other than the top.
So what can be causing this ? In order to force them to start at the top, is there something like the tabindex property in html ?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您遇到称为焦点自动移到其他位置而不是顶部位置字段的问题,那么您必须在活动生命周期的 onStart() 方法中简单地编写此代码,并在我的案例第一个字段中使用相应的字段 id
被firstfield_et引用,这是Activity.java文件的变量,并且它也已经被.xml文件中的etfirstfield引用,
代码如下:
if you have problem called focus is gone automatically on other place instead of top position's field then you have to write this code simply at onStart() method of activity life cycle with respective field id in my case first field
is referenced by firstfield_et this is the variable of Activity.java file and it is also already referenced by etfirstfield from .xml file
the code is simply as below: