修改CheckBox选择框、设置选择框颜色
使用组件自带的属性android:buttonTint可直接设置选择框的颜色修改选择框选中与未选中时的状态,需设置选择器 selector.XML<?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/androi...
·
使用组件自带的属性
android:buttonTint
可直接设置选择框的颜色
修改选择框选中与未选中时的状态,需设置选择器 selector.XML
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/check_box_checked" android:state_checked="true"/>
<item android:drawable="@drawable/check_box_checked" android:state_pressed="true"/>
<item android:drawable="@drawable/check_box_no_checked" android:state_checked="false"/>
<item android:drawable="@drawable/check_box_no_checked" android:state_pressed="false"/>
</selector>
然后在组件中引用 selector.XML 文件
<CheckBox
android:layout_width="25dp"
android:layout_height="25dp"
android:background="@drawable/selector"
android:button="@null"
android:checked="true"/>
选择框的大小是可进行控制的
Note:在重新设置选择框的风格时,加入属性 android:button="@null"
更多推荐
活动日历
查看更多
直播时间 2025-01-08 16:30:00


直播时间 2024-12-11 16:30:00


直播时间 2024-11-27 16:30:00


直播时间 2024-11-21 16:30:00


直播时间 2024-10-23 16:30:00


所有评论(0)