Android ImageButton Change Background onPress

<ImageButton android:src="@drawable/image_btn_src" ... />
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true" android:drawable="@drawable/icon_pressed"/>
    <item android:state_pressed="false" android:drawable="@drawable/icon_unpressed"/>
</selector>

http://stackoverflow.com/questions/12249495/android-imagebutton-change-image-onclick

Advertisements