android - show soft keyboard on demand

后端 未结 2 827
说谎
说谎 2020-12-07 05:59

Hi I wrapped edittext control onto a control that is being displayed on the screen at users request. It overlays the whole screen until user presses \'done\' button on the k

相关标签:
2条回答
  • 2020-12-07 06:31

    @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.

    0 讨论(0)
  • 2020-12-07 06:32

    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);
    
    0 讨论(0)
提交回复
热议问题