android - show soft keyboard on demand

无人久伴 提交于 2019-11-28 02:28:36
Kenny

In your showKeyboard function you are calling:

 imm.hideSoftInputFromWindow(this._textView.getWindowToken(), InputMethodManager.SHOW_IMPLICIT);

This will hide the softInput keyboard from the window! Do you want to show the keyboard? If yes then would you use:

 imm.showSoftInput(view, flags, resultReceiver);

EDIT: I think you can also toggle the keyboard from the InputMethodManager, try:

 imm.toggleSoftInput(0, 0);

@dropsOfJupiter

You can do: editText.requestFocus() as you launch the Activity or Fragment containing your EditText reference. This will give the focus to the EditText and will bring uo the SoftKeyboard.

I hope this helps.

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