配置好的checkBox 拿来就用

    xiaoxiao2021-12-14  19

    布局文件

    <CheckBox android:id="@+id/cb_agree" style="@style/CustomCheckboxTheme" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:text="@string/CheckBox_agree" android:paddingLeft="6dp" android:textColor="@color/black" android:textSize="@dimen/tSize16" />

    主题样式

    <style name="CustomCheckboxTheme" parent="@android:style/Widget.CompoundButton.CheckBox"> <item name="android:button">@drawable/checkbox_style</item> </style>

    状态选择器 默认点击的时候是屎黄的

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

    背景图片下载

    转载请注明原文地址: https://ju.6miu.com/read-964932.html

    最新回复(0)