Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/vim/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android上对话框中不显示键盘_Android - Fatal编程技术网

Android上对话框中不显示键盘

Android上对话框中不显示键盘,android,Android,我有一个活动,点击按钮时会显示一个对话框。但键盘不会显示在对话框中。这是我的代码: final DialogComfigPass comfigPass = new DialogComfigPass(ActivityTable.this); comfigPass. getWindow (). clearFlags ( WindowManager . LayoutParams . FLAG_NOT_FOCUSABLE | WindowManager . LayoutParams . FLAG_ALT

我有一个活动,点击按钮时会显示一个对话框。但键盘不会显示在对话框中。这是我的代码:

final DialogComfigPass comfigPass = new DialogComfigPass(ActivityTable.this);
comfigPass. getWindow (). clearFlags ( WindowManager . LayoutParams . FLAG_NOT_FOCUSABLE | WindowManager . LayoutParams . FLAG_ALT_FOCUSABLE_IM );
comfigPass.show();`

**您必须像这样在对话框中打开键盘**

    dialog.setOnShowListener(new OnShowListener() {

        @Override
        public void onShow(DialogInterface dialog) {

            InputMethodManager inputMethodManager = (InputMethodManager)this.getSystemService(
                            Context.INPUT_METHOD_SERVICE);
            inputMethodManager.toggleSoftInput(
                    InputMethodManager.SHOW_FORCED, 0);
        }
    });

**您必须像这样在对话框中打开键盘**

    dialog.setOnShowListener(new OnShowListener() {

        @Override
        public void onShow(DialogInterface dialog) {

            InputMethodManager inputMethodManager = (InputMethodManager)this.getSystemService(
                            Context.INPUT_METHOD_SERVICE);
            inputMethodManager.toggleSoftInput(
                    InputMethodManager.SHOW_FORCED, 0);
        }
    });

试试这个,它会工作:)
comfigPass.getWindow().setSoftInputMode(LayoutParams.SOFT\u INPUT\u STATE\u VISIBLE);‌​

尝试此方法它会起作用:)
comfigPass.getWindow().setSoftInputMode(LayoutParams.SOFT\u INPUT\u STATE\u VISIBLE);‌​

您可以使用
setSoftInputMode(LayoutParams.SOFT\u INPUT\u STATE\u可见);‌​

  // Show the keyboard when the dialog is displayed on the screen.
comfigPass.getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_VISIBLE);‌​
以前

comfigPass.show();
最后

final DialogComfigPass comfigPass = new DialogComfigPass(ActivityTable.this);
comfigPass. getWindow (). clearFlags ( WindowManager . LayoutParams . FLAG_NOT_FOCUSABLE | WindowManager . LayoutParams . FLAG_ALT_FOCUSABLE_IM );
comfigPass.getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_VISIBLE);‌​
comfigPass.show();`

您可以使用
setSoftInputMode(LayoutParams.SOFT\u INPUT\u STATE\u可见);‌​

  // Show the keyboard when the dialog is displayed on the screen.
comfigPass.getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_VISIBLE);‌​
以前

comfigPass.show();
最后

final DialogComfigPass comfigPass = new DialogComfigPass(ActivityTable.this);
comfigPass. getWindow (). clearFlags ( WindowManager . LayoutParams . FLAG_NOT_FOCUSABLE | WindowManager . LayoutParams . FLAG_ALT_FOCUSABLE_IM );
comfigPass.getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_VISIBLE);‌​
comfigPass.show();`
请使用

dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
请使用

dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);

添加
comfigPass.getWindow().setSoftInputMode(LayoutParams.SOFT\u INPUT\u STATE\u可见)输入
getDialog().getWindow().setSoftInputMode(LayoutParams.SOFT\u INPUT\u STATE\u可见)为什么要回滚编辑?您最初的帖子几乎难以辨认。@Henry我猜他是新来的,在这里发布您的完整代码Add
comfigPass.getWindow().setSoftInputMode(LayoutParams.SOFT\u INPUT\u STATE\u VISIBLE)输入
getDialog().getWindow().setSoftInputMode(LayoutParams.SOFT\u INPUT\u STATE\u可见)为什么要回滚编辑?你原来的帖子几乎难以辨认。@Henry我猜他是新来的,在这里发布你的完整代码集
SOFT\u INPUT\u STATE\u ALWAYS\u VISIBLE
set
SOFT\u INPUT\u STATE\u ALWAYS\u VISIBLE
给你的答案添加一些解释。给你的答案添加一些解释。