我正在尝试模仿手机“设置”应用中的 CheckBox
。
它看起来像这样:
我试过使用单独的 TextView
,但那样的话只有复选标记是可点击的,而不是文本和复选标记。
有办法实现吗?
我还尝试了 CheckedTextView
但找不到要使用的正确 drawable。
最佳答案
据我所知这是可行的
<?xml version="1.0" encoding="utf-8"?>
<CheckBox xmlns:android="http://schemas.android.com/apk/res/android"
android:text="Text"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:button="@null"
android:drawableRight="?android:attr/listChoiceIndicatorMultiple"/>
使用 android:button="@null"
删除标准复选框按钮/图像,然后将复选框图像添加为右侧可绘制对象(或使用 drawableEnd 支持 RTL)
android:drawableRight="?android:attr/listChoiceIndicatorMultiple"
关于android - Android 中 CheckBox 右侧的文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30233903/