今题项目中用到了Checkbox 但是要换掉样式 ,心想这还不简单 不就是background换掉就行吗 在drawable里面新建一个selector
内容如下
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/map_btn_current_pressed" android:state_pressed="true"/>
<item android:drawable="@drawable/map_btn_current_pressed" android:state_focused="true"/>
<item android:drawable="@drawable/map_btn_current_pressed" android:state_checked="true"/>
<item android:drawable="@drawable/map_btn_current" android:state_enabled="false"/>
<item android:drawable="@drawable/map_btn_current"/>
</selector>
这样的话就可以搞定,但是问题来了 不管怎么弄 就是没有按压效果 代码中也设置了
其实再我研究一番之后 原来是美工给的图片出了问题 什么问题呢 就是图片的位深度是32位的 安卓一般要求是需要24位的 重新绘制了一遍之后问题就解决了