android讲义2之在xml中设定imageButtion

//把此文件放在drawable下,然后可以通过android:background="@drawable/button_selector"或者android:src="@drawable/button_selector"下进行。
<?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/button_pressed"/><!-- pressed -->
     
<item android:state_focused="true"
           
android:drawable="@drawable/button_focused"/><!-- focused -->
     
<item android:drawable="@drawable/button_normal"/><!-- default -->
 
</selector>
原文地址:https://www.cnblogs.com/lee0oo0/p/2378705.html