I have a Button that uses a shape as it's background.
The shape will have different color based on the state of the Button
Is it possible for me to specify the color of each state inside the Button's xml? I am sorry for the newbie question.
Any guide please?
button_background.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_pressed="true" >
<shape android:shape="rectangle" >
<corners android:radius="10dp" />
<solid android:color="@color/colorPrimary" />
</shape>
</item>
<item android:state_focused="true">
<shape android:shape="rectangle" >
<corners android:radius="10dp" />
<solid android:color="@color/colorPrimary" />
</shape>
</item>
<item >
<shape android:shape="rectangle" >
<corners android:radius="10dp" />
<solid android:color="@color/colorWhite" />
</shape>
</item>
</selector>
How it is currently called
<Button
android:id="@+id/loginButton"
android:background="@drawable/button_background"
android:text="@string/login_button_title"/>