How to make an EditText selectable but not editable on Android Ice Cream Sandwich?-ThrowExceptions

Exception or error:

I have a ListView in Activity, and in each item , I insert an EditText for show my text.
I need drag the handle to select text & copy the text, but can not edit text.
On Android ICS, How can I do this?

How to solve:

text.setTextIsSelectable(true) requires API 11. For those using lower API’s:
In xml use:


This will make your EditText uneditable but selectable.


I think you could override the onKeyDown() method, make it do nothing but return true. It should catch the keypresses from the keyboard and negate them before they can go into the text in the EditText.

You might also try setting editable to false like this


on the EditText in your xml layout. However I am not certain if this will let you still highlight and copy, but it is worth a shot.


I resolved this problem.
Just set TextView like this:



Althouth android:editable is deprecated and Lint suggests to use inputType, It doesn’t seem to work. So android:editable="false"is apparently the best possible solution for all android versions.

    tools:ignore="Deprecated" />

Leave a Reply

Your email address will not be published. Required fields are marked *