Siva Kumar Siva Kumar - 19 days ago 5
Android Question

Make EditText behave as a TextView in code

How to make an EditText look like a TextView that is done in Java but not in XML..

I have seen how to do it using xml file like

style="@android:style/Widget.TextView"
android:editable="false"
android:cursorVisible="false"
android:longClickable="false"


but i want this to be done in java because i am not using any xml file for the layout..
everything is done in code itself ..
I am trying to use GestureListener in my code .. it worked fine for TextView but not EditText
So, anything to do for the EditText so that the GestureEvents can be implemented ?

Thanks,

Answer

EditText is a subclass of TextView - so except for editing, what applies to TextView applies to EditText as well.