开发者

Don't let button focus initially in touch mode

I have a layout in which the first button keeps grabbing focus as soon as the activity is started (if in touch mode). Is there a way to politely ask the activity to not auto-focus? I know I can put in a focusable dummy layout with 0 width/height to do this, seems like there should be something better.

Reference: Set initial focus i开发者_运维知识库n an android application

Thanks


I had this problem too. I got around it by setting the focusable and focusableInTouchMode attributes to true in the parent LinearLayout.

android:focusable="true"
android:focusableInTouchMode="true"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜