开发者

Change focus to a button while a listview is there, when loading the Activity

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

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();

Further I tried

listview.clearFocus();
button1.requestFocus();

Still didn't work.. Can anyone see anything that I am doin开发者_C百科g wrong or is there a proper way to do it?


Have you tried modifying focusableInTouchMode parameter? Similar problem is discussed here: Stop EditText from gaining focus at Activity startup

0

精彩评论

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