我之前用的是checkBox但是,没有修改过它的样式,今天想修改下样式,好像很多方法都不行。。
有的说在属性里加上 botton
<CheckBox
android:id="@+id/invitedPlanChoose"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginTop="20dp"
android:background="@drawable/shape_tuxing_sign001"
android:button = "@drawable/selector_check_box"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/invitedPlanIdCardInput"/>
但是没有效果呢?
不加的话,就是下图这样
我想将里面的方框,变为圆形的哈。。
把button设置为@null
background设置一个selectot
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
tools:ignore="MissingDefaultResource">
<item android:drawable="@drawable/按下样式" android:state_checked="true"/>
<item android:drawable="@drawable/没按样式"/>
</selector>