Automatic popping up keyboard on start Activity

后端 未结 19 989
醉梦人生
醉梦人生 2020-11-28 23:05

I got a relative simple question. I have an activity with a lot of EditText\'s in them. When I open the activity it automatically focusses to the first EditText and displays

相关标签:
19条回答
  • 2020-11-28 23:51

    If your view has EditText and Listview then Keyboard will open up by default. To hide keyboard from popping up by default do the following

    this.listView.requestFocus();
    

    Make sure you are requesting focus on listview after getting view for editText.

    For e.g.

    this.listView = (ListView) this.findViewById(R.id.list);
    this.editTextSearch = (EditText) this.findViewById(R.id.editTextSearch);
    this.listView.requestFocus();
    

    If you do it, then editText will get focus and keyboard will pop up.

    0 讨论(0)
提交回复
热议问题