SVG (Scalable Vector Graphics) in Android Studio
It is time consuming to scale the bitmap drawable for different density buckets. To make it easier Google added support for Vector Drawables starting from Lollipop (API level 21). The major advantage of Vector Drawables is that it can be scaled to any size without losing quality. Also you need to provide only one file rather than bitmap for each density buckets. Let us now discuss how to use SVG in android.
You cannot use the .svg file directly. The SVG needs to be converted to corresponding xml file. Starting from Android Studio 1.4 we can use theVector Asset Studio to make the process easier.
Another great news is that the Vector Asset Studio includes all the material design icons, so you do not need to download the icons separately.
Steps
1. Right click on the drawable folder select New -> Vector Asset
3. Then Next and Finish. You are done.
You can use this, similar to the normal drawable PNG in layouts.
Enjoy Coding :)
source :https://medium.com
No comments: