when using AlertDialog.Builder with EditText, the Soft Keyboard doesn't pop

前端 未结 12 1314
一生所求
一生所求 2020-11-30 23:13

I am using AlertDialog.Builder in order to create an input box, with EditText as the input method.

Unfortunately, the Soft Keyboard doesn\'t pop, al

12条回答
  •  天命终不由人
    2020-11-30 23:40

    I've managed to solve it like this:

    Dialog = builder.create();
    Dialog.show();
    Dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE  | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
    Dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
    

提交回复
热议问题