How to Prevent Keyboard appearing for EditText that is not enabled

前端 未结 6 762

My activity has an EditText which is supposedly not editable until user clicks on edit button for the screen.

I did edit.setEnabled(false)

6条回答
  •  逝去的感伤
    2021-01-05 16:35

    Attention that setEditable is depecrated.

    You can use :

    setInputType(EditorInfo.TYPE_CLASS_TEXT)
    

    To turn keyboard on.

    setInputType(EditorInfo.TYPE_NULL)
    

    To turn keyboard off.

提交回复
热议问题