Make EditText ReadOnly

前端 未结 22 1262

I want to make a read-only EditText view. The XML to do this code seems to be android:editable=\"false\", but I want to do this in code.

H

22条回答
  •  温柔的废话
    2020-12-04 19:10

    If you setEnabled(false) then your editText would look disabled (gray, etc). You may not want to change the visual aspect of your editor.

    A less intrusive way would be to use setFocusable(false).

    I believe that this answers your question closer to your initial intent.

提交回复
热议问题