How to hide Android soft keyboard on EditText

前端 未结 16 1113
长发绾君心
长发绾君心 2020-11-27 14:38

I have an Activity with some EditText fields and some buttons as a convenience for what normally would be used to populate those fields. However when we the user touches on

16条回答
  •  情深已故
    2020-11-27 15:07

    My test result:

    with setInputType:

    editText.setInputType(InputType.TYPE_NULL);
    

    the soft keyboard disappears, but the cursor will also disappear.

    with setShowSoftInputOnFocus:

    editText.setShowSoftInputOnFocus(false)
    

    It works as expected.

提交回复
热议问题