I need an EditText to appear as a TextView for a form that will change from being write to read only. I have found a useful snippet of code to do this in a layout:
<EditText android:id="@+id/title"
android:layout_width="fill_parent"
style="?android:attr/textViewStyle"
android:background="@null"
android:textColor="@null" />
I need to do this dynamically (not in the layout). I know that the background can be set to @null by using setBackgroundResource(null). Because setTextColor(int color) takes an int, I assume that a specific color must be selected. What is the correct color to choose that would be the equivalent to @null? A color from the default theme? Or is there a better way to do this?
You can call these methods on any
Viewto disable editing or clicking. It will effectively make the view read only. Set them totrueto re-enable them.