[英]Is there a way to bulk convert svg files using Android Asset Studio?
I have a large number of svg files I want to convert to xml vector assets for Android.我有大量的 svg 文件要转换为 Android 的 xml 矢量资产。
The documented process is, for each file, File->New->Vector Asset.记录的过程是,对于每个文件,File->New->Vector Asset。 Then choose the svg file, click Next then Finish.然后选择 svg 文件,单击 Next 然后单击 Finish。
Is there a faster way?有没有更快的方法? Maybe a bash comment to launch Asset Studio?也许是启动 Asset Studio 的 bash 评论?
The Resource Manager tool that was added in Android Studio version 3.4 can bulk import SVGs and convert them into vector drawables. Android Studio 3.4 版中添加的资源管理器工具可以批量导入 SVG 并将其转换为矢量可绘制对象。
Tools
→ Resource Manager
Tools
→ Resource Manager
Drawable
tab选择Drawable
选项卡+
button in the top left corner单击左上角的+
按钮Import Drawables
选择Import Drawables
There you can select all the files you want to import at once.在那里您可以一次选择要导入的所有文件。 More details here .更多细节在这里。
There are few Git projects which would help you achieve the bulk conversion of svg files to Vector Drawable supported by android.很少有 Git 项目可以帮助您将 svg 文件批量转换为 Android 支持的 Vector Drawable。
Juraj Novák's : http://inloop.github.io/svg2android/ Juraj Novák 的: http : //inloop.github.io/svg2android/
SvgToVectorDrawableConverter original repo was deleted.SvgToVectorDrawableConverter原始存储库已删除。 But you could choose one of the fork .但是你可以选择其中一个叉子。 Example: svg2vd -i "\\*" -o out --fix-fill-type
示例: svg2vd -i "\\*" -o out --fix-fill-type
For single conversion: SVG to Vector Drawable Convertor online单次转换: SVG to Vector Drawable Converter Online
Use wrapper of original converter ported from Android Studio使用从 Android Studio 移植的原始转换器的包装器
Hope it helps!希望能帮助到你!
下载这个 jar 文件并像下面的例子一样使用它
java -jar C:\Users\dan\Downloads\Svg2VectorAndroid-1.0.jar C:\Users\dan\Desktop\svgs_dir
Keep Svg2VectorAndroid.jar
and the folder that having all the Svg file in same folder and then open cmd
and go to that folder path where you put your jar and source folder and then execute the command将Svg2VectorAndroid.jar
和包含所有 Svg 文件的文件夹保存在同一文件夹中,然后打开cmd
并转到放置 jar 和源文件夹的文件夹路径,然后执行命令
java -jar Svg2VectorAndroid.jar <source folder name>
and press enter.并按回车键。 Now you can get your all xml file in source folder with folder name ProcessedSVG
.现在您可以在源文件夹中获取所有 xml 文件,文件夹名称为ProcessedSVG
。
Hope it helps.希望能帮助到你。
Use this link, it's really helpful : https://svg2vector.com/使用此链接,它真的很有帮助: https : //svg2vector.com/
Just upload your svg file (you can select multiple files) and download all drawable files.只需上传您的 svg 文件(您可以选择多个文件)并下载所有可绘制文件。 Just copy to your Drawable project file and viola!只需复制到您的 Drawable 项目文件和中提琴即可!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.