实现 点击 时 有按压效果 更换颜色
<ImageButton
android:id="@+id/mediacontroller_Fullscreen_or_not"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
android:contentDescription="@string/mediacontroller_Fullscreen_or_not"
android:background="@drawable/mediacontroller_fullscreen_selector"
android:src="@drawable/mediacontroller_fullscreen" />
mediacontroller_fullscreen_selector.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/mediacontroller_bg_pressed" android:state_focused="true"/>
<item android:drawable="@color/mediacontroller_bg_pressed" android:state_pressed="true"/>
<item android:drawable="@color/transparent" android:state_enabled="false"/>
<item android:drawable="@color/transparent"/>
</selector>
colors.xml
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<color name="transparent">#00000000</color>
<color name="mediacontroller_bg_pressed">#ff53c1bd</color>
<color name="mediacontroller_bg">#99000000</color>
</resources>