大致步骤:
一、创建selector
二、创建style
三、设置style
:一、name:checkbox_style 注意:check,nocheck 为png
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/check" android:state_checked="true"/>
<item android:drawable="@drawable/nocheck" android:state_checked="false"/>
<item android:drawable="@drawable/nocheck"/>
</selector>
:二、name:CustomCheckboxTheme
<style name="CustomCheckboxTheme" parent="@android:style/Widget.CompoundButton.CheckBox">
<item name="android:button">@drawable/checkbox_style</item>
</style>
:三、

这篇博客详细介绍了如何创建并应用自定义的Android复选框样式。首先,通过创建一个selector XML文件来定义选中和未选中状态的图片资源。接着,定义一个名为CustomCheckboxTheme的风格,将selector设置为复选框的按钮。最后,将这个主题应用到你的布局中,从而改变复选框的视觉外观。
1274

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



