How to change the text color of the widget EditText, in the state of enabled (false)?
- If you are given an exhaustive answer, mark it as correct (a daw opposite the selected answer). - Nicolas Chabanovsky ♦
|
1 answer
You need a selector:
- Create an
example.xmlfile in theres/drawable
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_enabled="false" android:color="@color/disabled_color" /> <item android:color="@color/normal_color"/> </selector> - Specify this file as the text color for the desired view:
<EditText android:text="whatever text you want" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="@color/example" /> |