select_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/main_index_search_pressed"></item> <!-- 正常情况下的图片 --> <item android:drawable="@drawable/main_index_search_normal"></item> </selector>
<ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:background="@drawable/select_drawble" android:onClick="clickIV" />