Android: Dialog box show soft keyboard automatically when focus is on an EditText not working

前端 未结 2 2033
耶瑟儿~
耶瑟儿~ 2020-12-11 21:03

Android: show soft keyboard automatically when focus is on an EditText

I\'ve read this post that automatically shows the virtual keyboard when a dialog box is shown.

2条回答
  •  半阙折子戏
    2020-12-11 21:52

    Just try adding the below line before "et.setOnFocusChangeListener"

    ((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE))
                        .showSoftInput(et, 2);
    

提交回复
热议问题