EditText in PopupWindow not showing keyboard even if setFocusable(true)

烈酒焚心 提交于 2019-11-29 05:51:21
yhunz_19

ha, .found the answer., just did

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

thanks for the support! credits from this topic Keyboard not shown when i click on edittextview in android?

Try adding this line before you show the popup:

popupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
kamleshwer purohit

This worked for me:

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

Nothing helped me, it still didn't appear on some devices, so I had to forced showing it like that (kotlin):

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)
    }

Try this::

Programatically:

edittext.requestFocus();

Through xml:

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

Hope it Helps!!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!