<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:button="@drawable/setting_checkbox"
android:text="记住密码"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:button="@drawable/setting_checkbox"
android:text="记住密码"
/>
setting_checkbox.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/setting_checkbox_s" android:state_checked="true"/>
<item android:drawable="@drawable/setting_checkbox" android:state_checked="false"/>
</selector>
本文介绍如何在Android中使用自定义的CheckBox样式,并展示了具体的XML代码实现。通过设置不同的状态资源文件,可以改变CheckBox选中和未选中时的外观。
1912

被折叠的 条评论
为什么被折叠?



