不要让按钮焦点最初在触摸模式 [英] Don't let button focus initially in touch mode

查看:220
本文介绍了不要让按钮焦点最初在触摸模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个布局,其中作为活动被启动(如果在触摸模式)的第一个按钮不断尽快敛焦点。有没有一种方法来礼貌地询问了活动,不支持自动对焦?我知道我可以把一个聚焦的虚拟布局0宽度/高度要做到这一点,似乎应该有更好的东西。

参考:在Android应用程序

感谢


解决方案

我有这个问题了。我周围有通过设置可聚焦和focusableInTouchMode属性为true父的LinearLayout。

 机器人:可聚焦=真
机器人:focusableInTouchMode =真

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 in 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"

这篇关于不要让按钮焦点最初在触摸模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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