how do you use svg in drawable folder?

问题: i am creating a bottom navigation bar for a android app following this guide however, when using svg in android:icon and building it, it shows a error Error: The f...

问题:

i am creating a bottom navigation bar for a android app following this guide

however, when using svg in android:icon and building it, it shows a error

Error: The file name must end with .xml or .png

i found out that i needed to move the svg to the assets folder. but if i move it, i can't use the svg... any help is much appreciated, thank you


回答1:

Android uses vector drawables which are xml files rather than SVG's.

You will have to convert the SVG to a vector drawable. Many ways of doing it but a handy web tool is available here.

It won't do complex SVG's but copes with the majority.

  • 发表于 2018-07-09 05:15
  • 阅读 ( 366 )
  • 分类:sof

条评论

请先 登录 后评论
不写代码的码农
小编

篇文章

作家榜 »

  1. 小编 文章
返回顶部
部分文章转自于网络,若有侵权请联系我们删除