Easiest way to use SVG in Android?

CommonSenseCode picture CommonSenseCode · Jun 18, 2015 · Viewed 149.6k times · Source

I have found a myriad of libraries in order to use svg in Android and avoid the frustrating creation of different resolutions and dropping files for each resolution, this becomes very annoying when the app has many icons or images.

Can anyone be as kind to give a step by step process of the simplest to use library for using SVG in Android, I'm sure this will help many others too.

Also I use Android Studio and Illustrator for generating my icons and images.

Answer

Pallavi Jain picture Pallavi Jain · Sep 1, 2016

First you need to import svg files by following simple steps.

  1. Right click on drawable
  2. Click new
  3. Select Vector Asset

If image is available in your computer then select local svg file. After that select the image path and an option to change the size of the image is also available at the right side of dialog if you want to . in this way svg image is imported in your project After that for using this image use the same procedure

@drawable/yourimagename