在drawable里面新建一个xml的文件,
里面写上:
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@mipmap/dirtyclothes_true_new" android:state_pressed="true"/> <item android:drawable="@mipmap/dirtyclothes_false_new" android:state_focused="false" android:state_pressed="false"/> <item android:drawable="@mipmap/dirtyclothes_true_new" android:state_focused="true"/> <item android:drawable="@mipmap/dirtyclothes_false_new" android:state_focused="false"/> </selector>
在imageview的background里面用这个xml就可以。