自定义CheckBox样式
Q: 觉得之前样式的CheckBox样式不好看,想自定义
Like: 效果
How to do?
xml
<CheckBox
android:id="@+id/login_chk"
android:layout_width="@dimen/dp_20"
android:layout_height="@dimen/dp_20"
android:layout_marginEnd="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
android:background="@drawable/login_checkbox"
android:button="@null"
android:checked="false"
tools:ignore="HardcodedText" />
drawable
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@mipmap/login_selected" android:state_checked="true" />
<item android:drawable="@mipmap/login_select_none" android:state_checked="false" />
<item android:drawable="@mipmap/login_selected" android:state_pressed="true" />
<item android:drawable="@mipmap/login_select_none" />
</selector>
|