如何创建并显示一个布局时,在视图上设置焦点? [英] How to set focus on a view when a layout is created and displayed?
问题描述
目前,我有一个布局,其中包含一个按钮
,一个的TextView
和的EditText
。当显示布局,重点将自动放置在的EditText
,将触发键盘显示在Android手机。这不是我想要的。有没有什么办法,我可以将重点放在的TextView
或上什么都不显示的布局时?谢谢你。
将焦点设置:该框架将处理 响应于用户移动焦点 输入。要强制集中到一个特定的 观点,叫 requestFocus的()
Currently, I have a layout which contains a Button
, a TextView
and an EditText
. When the layout is displayed, the focus will be automatically put on the EditText
, which will trigger the keyboard to show up on Android phone. It is not what I want. Is there any way that I can set the focus on TextView
or on nothing when a layout is displayed? Thanks.
Set focus: The framework will handled moving focus in response to user input. To force focus to a specific view, call requestFocus()
这篇关于如何创建并显示一个布局时,在视图上设置焦点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!