androidsvgandroidsvg

What is the easiest way to use SVG images in Android?


I have found a myriad of libraries in order to use SVG images 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.

What would be a step-by-step process of the simplest-to-use library for using SVG images in Android?

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


Solution

  • First, you need to import SVG files by the following simple steps.

    1. Right click on your project's drawable folder (app/res/drawable)
    2. Click New
    3. Select Vector Asset
    

    If the image is available on your computer, select the local svg file.

    After that, select the image path. An option to change the size of the image is also available on the right side of the dialog if you want to. In this way, the SVG image is imported into your project.

    After that, for using this image, use the same procedure:

    @drawable/ic_image_name