I followed this thread Change the color of a disabled button in android and successfully created two different styled buttons for enabled/disabled state.
However the difference is in the background color of the button: When disabled, the background color is green, when enabled it's blue.
How can I change the text color of the button from white to greyish depending on its state?
layout.xml
<Button
android:id="@+id/loginButton"
style="@style/StandardButton"
android:enabled="false"
android:layout_width="@dimen/standard_width"
android:layout_height="@dimen/standard_height"
android:layout_marginTop="8dp"
android:onClick="onSignup"
android:text="@string/signup_button_text"/>
styles.xml
<style name="StandardButton">
<item name="android:background">@drawable/standard_button_rounded</item>
<item name="android:textColor">@color/white</item>
<item name="android:textSize">20sp</item>
<item name="android:layout_gravity">center_horizontal</item>
<item name="android:layout_margin">5dp</item>
<item name="android:foreground">?attr/selectableItemBackground</item>
<item name="android:clickable">true</item>
</style>
standard_button_rounded.xml:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/standard_button_rounded_enabled" android:state_enabled="true" />
<item android:drawable="@drawable/standard_button_rounded_disabled" android:state_enabled="false" />
</selector>
standard_button_rounded_enabled.xml:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"
android:padding="10dp">
<solid android:color="@color/colorAccent"/>
<corners android:radius="@dimen/standard_button_radius"/>
</shape>
standard_button_rounded_disabled.xml:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"
android:padding="10dp">
<solid android:color="@color/green"/>
<corners android:radius="@dimen/standard_button_radius"/>
</shape>