一张图片做选择器

直接上图

这里使用了selected的新的定义方式

<ImageButton
    android:button="@null"
    android:id="@+id/btn_click"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/btn_evg_selestor" />
  • 下面是选择器

    btn_evg_selestor

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/img_1_1" android:state_selected="true" />
    <item android:drawable="@drawable/img_1" />
</selector>

img_1_1 的也贴出来

<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/img_1"
android:tintMode="multiply"
android:tint="#58ffd6"
>
</bitmap>

这里采用了android:tintMode=”multiply”

android:tint=”#58ffd6”