可以在drawable下创建一个xml文件
<!--?xml version=
"1.0"
encoding=
"utf-8"
?-->
<bitmap xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@id/toolbar_bg_bmp"
android:src=
"@drawable/toolbar_bg"
android:tilemode=
"disabled"
android:gravity=
"center
"
>
</bitmap>
下面内容适合不同选中状态 图片
<!--?xml version=
"1.0"
encoding=
"utf-8"
?-->
<item android:state_pressed=
"true"
>
<bitmap android:src=
"@drawable/toolbar_bg_sel"
android:tileMode=
"disabled"
android:gravity=
"center"
>
</bitmap></item>
<item>
<bitmap android:src=
"@drawable/toolbar_bg"
android:tileMode=
"disabled"
android:gravity=
"center
"
>
</bitmap></item>
</selector>