Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make Android Studio automatically create Vector drawable from svg files?

I am using Android Studio 2.0 and am targeting SDK verion 21 which supports vector images.

I add the .svg file from New->Vector Asset and it generates a drawable from it (.xml).

The problem is that when i change the .svg (in a vector graphics editor) then the .xml is not automatically updated inside the Studio. How to make it automatically update the generated .xml files if the .svg changes?

Regards!

like image 247
ele lont Avatar asked Jun 17 '16 13:06

ele lont


People also ask

Can we use SVG in drawable android?

Android Studio includes a tool called Vector Asset Studio that helps you add material icons and import Scalable Vector Graphic (SVG) and Adobe Photoshop Document (PSD) files into your project as vector drawable resources.

What is the default location of the vector icons imported through Android Studio?

@Apurva its not always true.In new version of android studio if you import a launcher icon via image asset then it will go in res/mipmap instead.

What is viewportHeight android?

android:viewportHeight. Used to define the height of the viewport space. Viewport is basically the virtual canvas where the paths are drawn on.


Video Answer


1 Answers

The answer is: you can!!

And it is very easy! Just click right button on folder(drawable for ex.) and choose:

enter image description here

then choose:

enter image description here

and your got it!

(There are some restrictions: https://developer.android.com/studio/write/vector-asset-studio.html#PSD)

like image 79
Vladyslav Ulianytskyi Avatar answered Oct 10 '22 15:10

Vladyslav Ulianytskyi