Automatic popping up keyboard on start Activity

后端 未结 19 1063
醉梦人生
醉梦人生 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:24

    https://stackoverflow.com/a/11627976/5217837 This is almost correct:

    @Override
    public void onCreate(Bundle savedInstanceState) {
    
    getWindow().setSoftInputMode(
       WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
    
    }
    

    But it should be SOFT_INPUT_STATE_HIDDEN rather than SOFT_INPUT_STATE_ALWAYS_VISIBLE

提交回复
热议问题