【问题标题】:Android Studio Vector Asset Import Error - Tags Not SupportedAndroid Studio 矢量资产导入错误 - 不支持标签
【发布时间】:2016-01-12 20:14:48
【问题描述】:

我一直在使用新的 gradle 插件 - 1.4.0-beta3 测试 Andorid Studio。

我一直在尝试导入我自己用 Inkscape 制作的矢量素材。但是我不断收到导入错误。错误消息在 svg 中包含许多不受支持的标签。

In mm_card.svg:
ERROR@ line 54 <defs> is not supported
ERROR@ line 56 <linearGradient> is not supported
ERROR@ line 58 <stop> is not supported
ERROR@ line 62 <stop> is not supported
ERROR@ line 66 <stop> is not supported
ERROR@ line 70 <stop> is not supported
ERROR@ line 74 <stop> is not supported
ERROR@ line 78 <stop> is not supported
ERROR@ line 83 <linearGradient> is not supported
ERROR@ line 85 <stop> is not supported
ERROR@ line 89 <stop> is not supported
ERROR@ line 93 <stop> is not supported
ERROR@ line 97 <stop> is not supported
ERROR@ line 102 <linearGradient> is not supported
ERROR@ line 104 <stop> is not supported
ERROR@ line 108 <stop> is not supported
ERROR@ line 113 <linearGradient> is not supported
ERROR@ line 115 <stop> is not supported
ERROR@ line 119 <stop> is not supported
ERROR@ line 123 <stop> is not supported
ERROR@ line 127 <stop> is not supported
ERROR@ line 131 <stop> is not supported
ERROR@ line 135 <stop> is not supported
ERROR@ line 139 <stop> is not supported

有人知道这是什么原因吗?是矢量资产工具中的错误吗?或者可能是 Inkscape 创建的 svg 有问题?还是不支持更复杂的 svg?

谢谢!

【问题讨论】:

  • 这似乎是不允许的基本内容。大多数 SVG 将具有 元素,并且大部分 SVG 将具有线性渐变。
  • 我遇到了从 CorelDraw 到 Android 矢量资产导入的问题。然后我找到了解决方案:尝试使用此工具将您导出的 SVG 转换为矢量:shapeshifter.design 如果它解决了您的问题

标签: android svg android-studio vector-graphics


【解决方案1】:

Android Studio 中的 SVG 导入功能仅对部分 SVG 功能提供有限支持。

他们在their announcement video 中声明了很多。他们说他们打算改进进口商。

但还要注意,VectorDrawables 无论如何都不支持渐变。

【讨论】:

  • 视频中说的 的替代方法是复制矢量代码并应用某些更改来修复错误。
  • 他们的意思是复制路径定义。这是&lt;path&gt; 元素的d 属性中的值。
  • VectorDrawables 不支持渐变,但您可以使用 GradientDrawable 作为 ImageView 背景或作为 LayerDrawable 的一部分来获得相同的效果
猜你喜欢
  • 2016-02-13
  • 2017-05-16
  • 1970-01-01
  • 2017-01-29
  • 1970-01-01
  • 1970-01-01
  • 2017-06-06
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多