您可以使用自定义复选框xml文件。将以下xml代码保存在drawables文件夹中,将其命名为custom_checkbox.xml:

android:drawable="@drawable/cbchk_blue"

android:state_focused="false">

android:drawable="@drawable/cbchk_blue"

android:state_focused="true">

android:drawable="@drawable/cbunchk_blue"

android:state_focused="false">

android:drawable="@drawable/cbunchk_blue"

android:state_focused="true">

然后使用此文件作为您的复选框的背景,如下:

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:button="@drawable/custom_checkbox"

android:id="@+id/checkBox" />

这里我上传我自己的图像,我用来代替cbchk_blue和cbunchk_blue

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐