Hiding the android keyboard for EditText

前端 未结 10 2083
慢半拍i
慢半拍i 2020-12-17 14:27

Whenever I click in the EditText the Android keyboard popup window appears, but I don\'t want the keyboard to pop up.

I want to permanently hide the and

10条回答
  •  情书的邮戳
    2020-12-17 15:08

    Setting the flag textIsSelectable to true disables the soft keyboard.

    You can set it in your xml layout like this:

    
    

    Or programmatically, like this:

    EditText editText = (EditText) findViewById(R.id.editText);
    editText.setTextIsSelectable(true);
    

    The cursor will still be present, you'll be able to select/copy/cut/paste but the soft keyboard will never show.

提交回复
热议问题