矢量资产工作室是进口丰富多彩.svg文件黑色和白色 [英] Vector Asset Studio is importing colorful .svg file as black and white
问题描述
我使用的指令中找到,从谷歌使用新的选项(2016年3月),以文件导入到名为.svg绘制,而不是.png文件。
I'm using the instructions found here, from Google to use the new option (March 2016) to import .svg files into drawable instead of .png files.
我的问题是,该文件被导入为黑色和白色,即使该文件具有多种颜色。
The problem I have is that the file gets imported as black and white, even though the file has many colors.
Here's an image of the .svg file, as read by Google Chrome:
This same file, is then read like this by the Vector Asset Studio:
和在应用程序,图像显示为黑白色。
And in the app, the image shows up as black and white.
为什么这个任何想法是怎么回事?
Any idea of why this is happening?
越做越Adobe公司的Photoshop创意云产生的.svg文件,而我使用的Android 1.5.1工作室在Mac上。
The .svg file is getting generated on Adobe PhotoShop Creative Cloud, and I'm using Android Studio 1.5.1 on Mac.
感谢您!
编辑:添加链接.svg文件我使用为这个问题。
added link to .svg file I'm using for this question.
推荐答案
Android的工作室的SVG进口受到限制。它只能处理很简单的SVG文件。我不相信它支持<风格>
元素,或类
属性。所以,你需要的CSS改变为XML属性。
Android Studio's SVG importer is somewhat limited. It only handles very simple SVG files. And I don't believe it supports the <style>
element, or the class
attribute. So you will need to change the CSS to XML properties.
例如:
<path class="st0" d="M163.3,10.8c2.4-0.5,6.2-0.9,10-0.9c5.5,0,9,0.9,11.6,3.1c2.2,1.6,3.5,4.1,3.5,7.5c0,4.1-2.7,7.7-7.2,9.3v0.1
c4,1,8.7,4.3,8.7,10.6c0,3.6-1.4,6.4-3.6,8.5c-3,2.7-7.7,4-14.6,4c-3.8,0-6.7-0.3-8.5-0.5V10.8z M168.8,28.1h5c5.8,0,9.2-3,9.2-7.1
c0-5-3.8-6.9-9.3-6.9c-2.5,0-4,0.2-4.8,0.4V28.1z M168.8,48.4c1.1,0.2,2.6,0.3,4.6,0.3c5.7,0,10.9-2.1,10.9-8.2
c0-5.8-5-8.2-10.9-8.2h-4.5V48.4z"/>
是否需要更改为:
Will need to be changed to:
<path fill="#007299" d="M163.3,10.8c2.4-0.5,6.2-0.9,10-0.9c5.5,0,9,0.9,11.6,3.1c2.2,1.6,3.5,4.1,3.5,7.5c0,4.1-2.7,7.7-7.2,9.3v0.1
c4,1,8.7,4.3,8.7,10.6c0,3.6-1.4,6.4-3.6,8.5c-3,2.7-7.7,4-14.6,4c-3.8,0-6.7-0.3-8.5-0.5V10.8z M168.8,28.1h5c5.8,0,9.2-3,9.2-7.1
c0-5-3.8-6.9-9.3-6.9c-2.5,0-4,0.2-4.8,0.4V28.1z M168.8,48.4c1.1,0.2,2.6,0.3,4.6,0.3c5.7,0,10.9-2.1,10.9-8.2
c0-5.8-5-8.2-10.9-8.2h-4.5V48.4z"/>
对于诸如此类的其余&LT;路径方式&gt;
元素
这篇关于矢量资产工作室是进口丰富多彩.svg文件黑色和白色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!