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);
本文介绍了一种解决AlertDialog在显示时无法获得焦点及软键盘不自动弹出的问题的方法。通过设置对话框的属性,确保在AlertDialog显示时能够正确地处理焦点与软键盘状态。
712

被折叠的 条评论
为什么被折叠?



