自定义对话框AlertDialog.getWindow().setContentView(view)是EditText无法输入

来源:互联网 发布:webshell清除IP 编辑:程序博客网 时间:2024/05/20 16:44

这个setContentView(View)的方法在原理上设置了限定,该是默认情况下隐藏软键盘的方法,要重新显示软键盘,要执行下面这段代码:

dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
完整点的使用代码:
<span style="white-space:pre"></span>final LinearLayout dialogLayout = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.dialog_input_master,null);        final Dialog dialog = new AlertDialog.Builder(this).create();        dialog.show();        dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);        dialog.getWindow().setContentView(dialogLayout);




0 0
原创粉丝点击