加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-16 23:29:32 所属栏目:百科 来源:网络整理
导读:我想知道是否有机会在 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://sc
我想知道是否有机会在 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,-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.0l7.0,-2.0l7.0,2.0l0.0,-3.0l-4.0,-3.0L26.0,27.0L42.0,32.0z"

  /group

/vector>

第一条路径是我要用径向色调填充的背景圆圈,我可以用纯色填充它直到现在……我还没有在网上找到任何东西……你能帮帮我吗?

答案:我找到了答案here

VectorDrawable不支持api 24以下的渐变

解决方法

来自SDK文档: VectorDrawable

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

安卓则strokeColor
指定用于绘制路径轮廓的颜色.可以是颜色,则不绘制路径轮廓.

VectorDrawable

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读