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.
A:
The developer doc page indicates that the proper substitute (since you are correct - editable
is deprecated) is to use android:inputType
instead. Specifically:
android:inputType="none"
Have you tried that?
eldarerathis
2010-10-13 23:18:55
Yes. No joy. :(
Fran Fitzpatrick
2010-10-14 02:43:28
A:
They made "editable" deprecated but didn't provide a working corresponding one in inputType.
By the way, does inputType="none" has any effect? Using it or not does not make any difference as far as I see.
For example, the default editText is said to be single line. But you have to select an inputType for it to be single line. And if you select "none", it is still multiline.
Tim
2010-10-20 02:14:35
A:
Hi, What sdk are you using? I'm running android2.1 and set:
android:editable="false"
CAN work.
And I also tried in android2.2, it can work too.
This is my xml slice:
<EditText
android:id="@+id/edit_question"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:editable="false"
android:maxLines="4"
/>
herbertD
2010-10-20 02:37:07