I am using TextView
as a Button
(flat UI) in my android application. Below is the code
<TextView
android:id="@+id/button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:background="@drawable/button_background"
android:enabled="false"
android:gravity="center"
android:paddingBottom="16dp"
android:paddingTop="16dp"
android:text="Sign Up"
android:textColor="@color/white"
android:textSize="16sp"
android:textStyle="bold" />
The background drawable 'button_background' is
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="#FCD5A5" android:state_enabled="false" />
<item android:drawable="#F7941E" />
So when Button
is enabled it should have dark orange background otherwise light orange background.
Background color is working fine with both the states (enabled and disabled) but text color is also getting changed. It remains white in enabled state but changes to dark grey in disabled state. I want to keep it white in both the states.