要实现的效果图
image.png
<androidx.appcompat.widget.AppCompatCheckBox
android:id="@+id/view_controller_payment_selection_wxpay_check_box"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_xlarge"
android:button="@drawable/selector_checkbox_gradient_payments"
android:checked="true"
android:drawableEnd="@drawable/ic_wechat"
android:drawablePadding="@dimen/margin_large"
android:layoutDirection="rtl"
android:padding="@dimen/margin_xlarge"
android:paddingHorizontal="10dp"
android:paddingVertical="10dp"
android:text="Wechat"
android:textDirection="ltr" />
selector_checkbox_gradient_payments.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ic_checked" android:state_checked="true" />
<item android:drawable="@drawable/ic_check_off" android:state_checked="false" />
<item android:drawable="@drawable/ic_check_off" />
</selector>
网友评论