Android 单选按钮/复选框中未正确显示VectorDrawable
问题:我有一个向量可绘制,但在RadioButton/CheckBox中没有正确显示。这里只显示了一个灰色的圆圈,而我需要在一个棕色圆圈内打勾。 下面是向量:Android 单选按钮/复选框中未正确显示VectorDrawable,android,android-vectordrawable,Android,Android Vectordrawable,问题:我有一个向量可绘制,但在RadioButton/CheckBox中没有正确显示。这里只显示了一个灰色的圆圈,而我需要在一个棕色圆圈内打勾。 下面是向量: <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="22dp" android:height="23dp" android:viewpor
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="22dp"
android:height="23dp"
android:viewportWidth="22"
android:viewportHeight="23">
<path
android:fillColor="#8a3511"
android:fillType="evenOdd"
android:pathData="M11,11m-11,0a11,11 0,1 1,22 0a11,11 0,1 1,-22 0" />
<group>
<clip-path android:pathData="M11,11m-11,0a11,11 0,1 1,22 0a11,11 0,1 1,-22 0" />
<path
android:fillColor="#00000000"
android:fillType="evenOdd"
android:pathData="M4.5,11.5L8,15 16,7"
android:strokeWidth="1"
android:strokeColor="#FFF" />
</group>
</vector>
以下是可提取的状态:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/check_icon" />
</selector>
用法如下:
<com.google.android.material.checkbox.MaterialCheckBox
android:layout_marginStart="64dp"
android:id="@+id/checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center|end"
android:button="@drawable/checkbox"
/>
下面是视觉效果:
是的,灰色圆圈是我从中得到的全部:
尝试改用androidx.appcompat.widget.AppCompatCheckBox复选框