Androidg 改变CheckBox下的选中与未选中图片

来源:互联网 发布:平板 win10 知乎 2017 编辑:程序博客网 时间:2024/05/23 12:06

1.在res/drawable下创建selector 文件  文件名自己随意定义符合格式要求即可

<?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android">    <item android:drawable="@mipmap/ic_launcher" android:state_checked="true"/>    <item android:drawable="@mipmap/ic_launcher_round" android:state_checked="false"/></selector>

2.控件中修改CheckBox的button属性

<CheckBox    android:layout_width="wrap_content"    android:layout_height="wrap_content"    android:button="@drawable/check"    />


阅读全文
0 0