焦点更改为一个按钮,而列表视图是存在的,装载活动时 [英] Change focus to a button while a listview is there, when loading the Activity
问题描述
是否有可能将焦点到一个按钮,当活动开始,而一个ListView有在Android上的布局?我尝试以下code,但对我来说没有工作。
Is it possible to give focus to a button when the activity starts, while a listView is there on the layout in Android? I tried the following code, but didn't work for me.
button1.requestFocus();
另外我试过
listview.clearFocus();
button1.requestFocus();
仍然没有工作..任何人都可以看到什么,我做错了或者是有做一个适当的方式?
Still didn't work.. Can anyone see anything that I am doing wrong or is there a proper way to do it?
推荐答案
你试过修改 focusableInTouchMode
参数?类似的问题在这里讨论:<一href=\"http://stackoverflow.com/questions/1555109/stop-edittext-from-gaining-focus-at-activity-startup\">Stop从的EditText在活动启动时获得焦点?
Have you tried modifying focusableInTouchMode
parameter? Similar problem is discussed here: Stop EditText from gaining focus at Activity startup?
这篇关于焦点更改为一个按钮,而列表视图是存在的,装载活动时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!