android automate 教程,Android : automate SVG import

问题

We have a legacy Android project using drawables in the respective drawable folders for mdpi, hdpi, etc., We are planning to remove the PNG files and transition to SVG. The SVG Import UI described here creates the drawables xml from the svg. Is there a way to run this tool from command line so that we can automate the conversion from SVG to Android Drawable.xml format. We have a lot of files, so doing it manually is tedious. (Alternatively, if this is not possible, I will be writing a script to convert from SVG to Android Drawable.xml format. If such a tool already exists it will be very helpful.)

Thanks.

回答1:

The converter code from Android Studio can be found here:

SVG2Vector.java

It should be fairly easy to extract it and turn it into a command line utility.

回答2:

Look at this tool from the Android SDK source base:

https://www.androiddesignpatterns.com/2018/11/android-studio-svg-to-vector-cli.html

You can download a compiled version, or compile it yourself.

回答3:

Maybe too late, but I would recommend Respresso which is an online tool capable to batch convert SVG images to Android vector drawables. (If you need, it will also convert it to pdf for iOS.)

You have to upload the images (in batch) then sync the resized/converted ones directly to your project using the tool's gradle plugin.

Please note that it will require you to create an account (for free) as it will sync any change to your project directly. (So you can add/change an image (svg, pdf, png, jpeg, android drawable) and it will automatically add/change the converted files in your project at the next build.)

I worked on the tool and I think it is really cool and I use it personally. I have no shares in it. I hope you will also like it.

回答4:

Found an online tool : http://inloop.github.io/svg2android/

If there is a Android provided command line tool, it will be very helpful in terms of automating via scripts.

来源:https://stackoverflow.com/questions/40927461/android-automate-svg-import

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值