Android 4.0 EditText course is always invisible for editable = false

In my application, I want EditTextone that does not accept any input, i.e. android:editable="false"in an XML layout or setKeyListener(null)in code.

I only want to add characters in a very controlled way, so I always add them programmatically with setText(), and I don't want any virtual keyboard to be displayed. However, I still need a visible cursor in EditTextso that the user knows where the program input will be inserted.

It was very easy to implement ( android:editable="false") prior to Android 4.0. In 4.0, the cursor has obviously been deleted. I tried android:cursorVisible="true", but it does not work.

Does anyone know how both have a visible cursor and still suppress input in Android 4.0? Very grateful for any help here.

+5
source share
3 answers

Please, try

 android:clickable="false"
+2
source

Set android file EditText android: focusable = false.

+1
source

I had a similar problem. Try using:

editText.setRawInputType(InputType.TYPE_CLASS_TEXT);
editText.setTextIsSelectable(true);

it worked for me. See http://code.google.com/p/android/issues/detail?id=27609 for details

+1
source

All Articles