点击图片时,按钮效果设置

在drawble中建立一个xml,内容是:

<?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/refresh2" /> 
<item android:state_pressed="false" 
android:drawable="@drawable/refresh1" /> 
</selector>
 

在相应的资源上:

android:src="@drawable/refresh"

相关推荐