image button on android

how to create an image button that when it's being clicked, it will change it's background only but not it's src?

here is the image button and it's attributes:

    <ImageButton
            android:layout_width="wrap_content"
            android:background="@drawable/btn_background"
            android:src="@drawable/button_playing_play"
            android:layout_height="wrap_content"/>

it's background is another drawable xml file:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/button_blue_press" android:state_pressed="true"/>
    <item android:drawable="@android:color/white"/>
</selector>

that's it!

你可能感兴趣的:(android,image,button,background)