I am trying to make ImageButton for clicked, focused and normal state. I read the introduction of ImageButton here
I saved the XML selector file in / res / drawable /. Also install android:src="@drawable/my_selector".
my_selector.xml file:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/btn_unfocus" />
<item android:state_pressed="true"
android:drawable="@drawable/btn_onpress" />
<item android:state_focused="true"
android:drawable="@drawable/btn_onfocus" />
</selector>
I think I did the right ImageButton. But that did not work for me.
What is wrong here?
Please advice.
source
share