Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make EditText not editable through XML in Android?

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.
like image 833
Fran Fitzpatrick Avatar asked Oct 13 '10 22:10

Fran Fitzpatrick


People also ask

How do you make EditText not editable?

Make EditText non editable in Android To use this just set android:inputType="none" and it will become non editable.

How do I edit text in xml?

Modify the default content of res/layout/activity_main. xml file to include Android UI control. Run the application to launch Android emulator and verify the result of the changes done in the application. Following is the content of the modified main activity file src/com.


1 Answers

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.

like image 91
GalDude33 Avatar answered Sep 19 '22 05:09

GalDude33