How to make EditText not editable through XML in Android?

Fran Fitzpatrick picture Fran Fitzpatrick · Oct 14, 2010 · Viewed 290.8k times · Source

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

  1. it is deprecated; and
  2. it didn't work.

Answer

GalDude33 picture GalDude33 · Oct 21, 2011

Add this to your EditText xml file:

<EditText ...
        android:clickable="false" 
        android:cursorVisible="false" 
        android:focusable="false" 
        android:focusableInTouchMode="false">
</EditText>

It will do the same effect as android:editable="false". Worked for me, hope it'll work for you too.