SVGs (Scalable Vector Graphics) are awesome. They resize themselves perfectly to any size without quality loss and thus allowing us to skip the tedious process of scale the image files for different density buckets.
In web development, we can use SVGs directly for improved front end performance. Unfortunately in Android development, we cannot use SVGs directly and need to convert them to their corresponding XML files. Doing this is used to be a tedious process (I think I remember doing this in web development, cobbling together various tools on the web), but Android Studio includes a tool called Vector Asset Studio to make this process easier.
Here are the steps to integrate your own SVGs into your Android app using Android Studio.
Right click on your drawable folder in Android Studio and then drill down to New -> and then select “Vector Asset”.
Do note that Android Studio comes with all of the SVG Material Design icons that you can export into appropriate XML formats. But in our case, we want to use our own SVG files, so select “Local file (SVG, PSD)” under Asset Type and choose the appropriate file under the Path section. Once you have selected your file, click “Finish”.
And that’s pretty much it. Clicking on that “Finish” button will create a new XML file that will be a representation of your SVG file under your drawable folder.