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 1

You need a selector:

  1. Create an example.xml file in the res/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> 
  1. 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" />