How to clear focus for EditText?

前端 未结 8 1117
滥情空心
滥情空心 2021-01-30 12:54

I have an activity with a search box (EditText) on the top, and a ListView below. Whenever the activity starts, the EditText always has focus and bring up the keybo

8条回答
  •  北荒
    北荒 (楼主)
    2021-01-30 13:53

    Try this

    On your Activity Declaration in AndroidManifest.xml add the below code :

    android:windowSoftInputMode="stateHidden"
    

    It will prevent the keyboard to popup up when activity becomes visible.

    Happy coding :)

提交回复
热议问题