How can I set the focus (and display the keyboard) on my EditText programmatically

后端 未结 13 849
隐瞒了意图╮
隐瞒了意图╮ 2020-11-28 02:22

I have a layout which contains some views like this:






&         


        
13条回答
  •  长情又很酷
    2020-11-28 02:50

    use:

    editText.requestFocus();
    InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
    

提交回复
热议问题