android - 我收到消息 import SVG with ERROR@不支持
问题描述
Android Studio 向我发送消息"ERROR@ <feGaussianBlur> is not supported"
,"ERROR@ <filter> is not supported"
当我尝试将 SVG 导入 xml 时!
我使用 Inkscape 制作和编辑 SVG 文件。任何解决方案?
更新
安卓工作室 3.4.0
矢量 xml 代码:
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="120dp"
android:height="70dp"
android:viewportWidth="120"
android:viewportHeight="70">
<path
android:pathData="m29.87,5.114h81.925c2.212,0 3.312,1.83 2.467,4.104l-19.088,51.359c-0.845,2.274 -3.306,4.104 -5.518,4.104L7.731,64.681c-2.212,0 -3.312,-1.83 -2.467,-4.104L24.352,9.218c0.845,-2.274 3.306,-4.104 5.518,-4.104z"
android:strokeWidth="0.43320084"
android:fillColor="#000000"
android:strokeColor="#00000000"
android:fillAlpha="1"/>
<path
android:pathData="m29.87,4.585h81.925c2.212,0 3.312,1.83 2.467,4.104L95.174,60.048c-0.845,2.274 -3.306,4.104 -5.518,4.104L7.731,64.152c-2.212,0 -3.312,-1.83 -2.467,-4.104L24.352,8.689c0.845,-2.274 3.306,-4.104 5.518,-4.104z"
android:strokeWidth="0.43320084"
android:fillColor="#aaffaa"
android:strokeColor="#00000000"/>
</vector>
错误信息:
错误@第 28 行:不支持
错误@第 36 行:不支持
解决方案
<filter>
并且feGuaussianBlur>
是 SVG 过滤器元素。他们为 SVG 元素添加位图滤镜效果。
Android VectorDrawables不支持 SVG 过滤器。
如果您可以在没有滤镜效果(模糊)的情况下生活,请编辑您的 SVG 文件并删除它/它们。然后再次尝试导入。
如果您需要模糊效果,那么您将无法使用 VectorDrawable。您将被迫改用位图图像。
推荐阅读
- arrays - 在另一个函数中从数组中检索数据
- list - 使用 StateNotifier Riverpod 上的方法来更改布尔值
- binary - 可以使用有符号乘法器执行无符号乘法吗?
- javascript - 激活弹出模式的Javascript不起作用
- javascript - 在“./Navbar/Navbar”中找不到导出“默认”(重新导出为“导航栏”)
- javascript - 块状的突变体
- file - 在 Windows 10 批处理文件中,有没有办法只提取最后的总文件数?
- java - WebSockets 和 Discord API 的问题
- javascript - JSPDF:如何在 jsPDF 中编码 blob?
- sorting - 为什么排序线将较短的“根”项放在底部?