Android PopupWindow中的EditText即使设置为可聚焦也不显示键盘(true)

Android PopupWindow中的EditText即使设置为可聚焦也不显示键盘(true),android,keyboard,android-edittext,popupwindow,Android,Keyboard,Android Edittext,Popupwindow,我似乎找不到这份工作。我已经将popWindow设置为我在其他论坛上读到的内容的焦点,但仍然没有运气 xml 我计划创建一个网络配置设置窗口。我似乎无法修复我的代码来为你们提供一个好的视图。试试这个:: 在程序上: edittext.requestFocus(); 通过xml: <EditText android:id="@+id/editText3" android:layout_width="match_parent" android:layout_height="wrap_cont

我似乎找不到这份工作。我已经将popWindow设置为我在其他论坛上读到的内容的焦点,但仍然没有运气

xml

我计划创建一个网络配置设置窗口。我似乎无法修复我的代码来为你们提供一个好的视图。

试试这个::

在程序上:

edittext.requestFocus();
通过xml:

<EditText
android:id="@+id/editText3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPersonName">
    <requestFocus />
</EditText>


希望能有帮助

在显示弹出窗口之前,尝试添加此行:

popupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
哈,找到答案了。, 刚刚

谢谢你的支持! 本专题的学分 这对我很有效:

popWindow.setFocusable(true);
popWindow.update();

没有任何帮助,它仍然没有出现在某些设备上,所以我不得不强制这样显示它(kotlin):

val editText=customView.findViewById(numberFieldDid)
editText.onClick{
显示键盘(编辑文本、上下文)
}
私人娱乐显示键盘(mEtSearch:EditText,context:context){
mEtSearch.requestFocus()
val imm=context.getSystemService(Activity.INPUT\u METHOD\u SERVICE)作为InputMethodManager
imm.toggleSoftInput(仅InputMethodManager.HIDE\u隐式\u,0)
}

试试看。不能用弹出窗口吗?我需要使用对话框片段吗,我把所有的东西都放在了第二个,我真的不明白为什么还是什么都没有。不起作用。大卫谢谢你的反馈,但是它起作用了,对我来说很好。为什么你投了-1票?我没有得到这个应该被选中的答案
popupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
popWindow.setFocusable(true);
popWindow.update();
popWindow.setFocusable(true);
popWindow.update();
val editText = customView.findViewById<EditText>(numberFieldId)
        editText.onClick {
            showKeyboard(editText, context)
        }

private fun showKeyboard(mEtSearch: EditText, context: Context) {
        mEtSearch.requestFocus()
        val imm = context.getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager
        imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0)
    }