AlertDialog dialog = new AlertDialog.Builder(this).create(); View view = LayoutInflater.from(mActivity).inflate(R.layout.dialog_check_result, null); dialog.setCanceledOnTouchOutside(false); 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);