用径向颜色阴影填充矢量 xml 路径

Fill a vector xml path with radial color shade

我想知道是否有机会在 XML-drawable 中用径向色度填充路径。

我的XML:

<?xml version="1.0" encoding="utf-8"?>
vector android:height="64.0dip" android:width="64.0dip" android:viewportWidth="64.0" android:viewportHeight="64.0"
xmlns:android="http://schemas.android.com/apk/res/android">

path android:fillColor="#ff2196f3" android:pathData="M 64.07531,31.855837 A 32.037655,32.037655 0 0 1 32.037655,63.893492 32.037655,32.037655 0 0 1 0,31.855837 32.037655,32.037655 0 0 1 32.037655,-0.18181801 32.037655,32.037655 0 0 1 64.07531,31.855837 Z" android:strokeWidth="1.0"

  group android:translateX="9.0" android:translateY="6.0"

   path android:fillColor="#ffffffff" android:pathData="M20.4,18.0"

   path android:fillColor="#ffffffff" android:pathData="M42.0,32.0l0.0,-4.0L26.0,18.0L26.0,7.0c0.0,-1.7 -1.3,-3.0 -3.0,-3.0c-1.7,0.0 -3.0,1.3 -3.0,3.0l0.0,11.0L4.0,28.0l0.0,4.0l16.0,-5.0l0.0,11.0l-4.0,3.0l0.0,3.0l7.0,-2.0l7.0,2.0l0.0,-3.0l-4.0,-3.0L26.0,27.0L42.0,32.0z"

  /group

/vector>

第一个路径是背景圆圈,我想用径向色度填充,我现在只能用纯色填充它..我在网上没有找到任何东西......你可以吗请帮帮我?

答案:我找到了答案here

VectorDrawable 不支持 api24

以下的渐变

来自 SDK 文档:VectorDrawable

android:填充颜色 指定用于填充路径的颜色。可以是一种颜色,对于 SDK 24+,可以是颜色状态列表或渐变颜色(参见 GradientColor and GradientColorItem)。如果此 属性 是动画的,则动画设置的任何值都将覆盖原始值。如果未指定 属性,则不会绘制路径填充。

android:描边颜色 指定用于绘制路径轮廓的颜色。可以是一种颜色,对于 SDK 24+,可以是颜色状态列表或渐变颜色(参见 GradientColor and GradientColorItem)。如果此 属性 是动画的,则动画设置的任何值都将覆盖原始值。如果不指定 属性,则不绘制路径轮廓。

VectorDrawable