I have a button like this:
<Button android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Hello" android:textColor="@color/primary" android:background="@drawable/button" />
Selectable button.xml :
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_enabled="false" android:drawable="@drawable/button_disabled" /> <item android:drawable="@drawable/button_default" /> </selector>
Selectable button_disabled.xml :
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid android:color="@color/white"/> </shape>
I also want to change the color of the button text when it is disabled. How to specify a different text color for each state?
source share