解决Dialog中EditText无法自动弹出输入框的问题

参考:https://www.cnblogs.com/tinyclear/p/6936901.html

       //解决dilaog中EditText无法弹出输入的问题
        dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
        //弹出对话框后直接弹出键盘
        et_newReason.setFocusableInTouchMode(true);
        et_newReason.requestFocus();
        CmzStaffApplication.handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                InputMethodManager inputManager =(InputMethodManager) et_newReason.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
                inputManager.showSoftInput(et_newReason, 0);
            }
        }, 100);

你可能感兴趣的:(解决Dialog中EditText无法自动弹出输入框的问题)