开发者

Don't let button focus initially in touch mode

开发者 https://www.devze.com 2023-03-28 01:17 出处:网络
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

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

精彩评论

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

关注公众号