Soft Keyboard shows up on EditText focus ONLY once

后端 未结 5 645
無奈伤痛
無奈伤痛 2020-11-30 06:08

Thanks for reading.

I am facing a strange problem: My app behavior is such that when the Activity starts, I requestFocus() on an Edi

5条回答
  •  春和景丽
    2020-11-30 06:43

    You used the wrong view for showing the input window.

    EditText editText = (EditText) findViewById(R.id.editText);
    editText.requestFocus();
    InputMethodManager imm =(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
    if(imm != null) {
        imm.showSoftInput(editText, 0); 
    }
    

提交回复
热议问题