How to make EditText not editable through XML in Android?

后端 未结 27 1818
梦谈多话
梦谈多话 2020-11-28 17:35

Can anyone tell me how to make an EditText not editable via XML? I tried setting android:editable to false, but

  1. it is de
27条回答
  •  离开以前
    2020-11-28 18:19

    As mentioned in other answers, you can do a setEnabled(false) but since you are asking how to set it via XML, here is how to do it.

    Add the following attribute to your EditText:

    android:enabled="false"
    

提交回复
热议问题