我在Illustrator中创建了一个简单的播放按钮图像,将其保存为SVG,使用在线SVG到Drawable转换器创建该文件的xml,然后尝试使用Android Studio的Vector Asset工具将文件导入到我的项目中。但是,导入时,绘图元素中的一个元素丢失了,在这种情况下,圆形中间的白色三角形不存在。将Vector资源导入Android Studio时出错
play_circle.xml(转换后的XML文件)
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:viewportWidth="94"
android:viewportHeight="102"
android:width="94dp"
android:height="102dp">
<path
android:pathData="M85 52.5A38.5 38.5 0 0 1 46.5 91 38.5 38.5 0 0 1 8
52.5 38.5 38.5 0 0 1 46.5 14 38.5 38.5 0 0 1 85 52.5Z"
android:strokeWidth="2"
android:fillColor="#424900"
android:strokeAlpha="0.29"
android:fillAlpha="0.29"
android:strokeColor="#000000"
android:strokeMiterLimit="10" />
<path
android:pathData="M71.39 51.63L34.81 30.51"
android:fillColor="#ffffff" />
</vector>
play_button.svg, as created in illustrator and how it's intended to be
您是否在drawable-v21中添加了此xml? –
是的。为了澄清,无论何时我在Android Studio中打开Vector Asset Import工具,图像已经混乱(不显示中间的白色三角形)。我不知道这个工具是否有bug – RustWebDev
你可以添加原始的SVG文件吗? – kazhiu