Android: How to Make A Drawable Selector
You can try this also as a selector
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- pressed -->
<item android:drawable="@drawable/button_1_selected" android:state_pressed="true"/>
<!-- focused -->
<item android:drawable="@drawable/button_1_normal" android:state_focused="true"/>
<!-- default -->
<item android:drawable="@drawable/button_1_normal"/>
</selector>
You can add this in Android Studio, use Right click on project structure -> New -> Drawable resource file
. It should look like this:
<?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/cell_top_selected" />
<item android:drawable="@drawable/cell_top" />
</selector>