SVG Source

Generator Options

Include Drawable Code Adds ~500 bytes
Class Name e.g. 'SvgObject'




The generated code can be used to draw directly to a Canvas

{{}}.draw(canvas, width, height);

This will draw the Svg inside rectangular bounds with an upper left corner at (0, 0) and a lower right at (width, height).

To translate the bounds to a custom anchor point (dx, dy): use the longer version of the draw method

{{}}.draw(canvas, width, height, dx, dy);


If you have chosen to include the Drawable code and want to use it inside e.g. an ImageView you can do so by first creating the Drawable:

Drawable icon = {{}}.getDrawable(size);

Where size is the greatest dimension (width/height) that the generated drawable will have.

Icon Tinting

If you want to tint your icon with a certain color you can set the icon tint using the following method. Please be warned that all methods are static which means the tint is applied accross your app and not only for the current drawing operation. Therefor calling the clearColorTint method after a draw operation is highly suggested.


If you don't want to worry about setting and clearing the tint value with every draw call the generated Drawables provide a "it just works" solution:

Drawable blueTintedIcon = {{}}.getTintedDrawable(
                                size, Color.BLUE);

The icon will be tinted blue when it is generated and won't change after that so you don't have to worry about anything.



SVG to Android provides a simple tool that can convert almost all SVG files into a single .java file. The .java file can then be used to draw to either a canvas or generate a Drawable to use in any View.

The reason for its existence is the poor native SVG support in Android. Only since Android Lollipop support was added for a very small subset of the SVG spec. The goal here is to provide a much broader subset of the spec while simultaniously backporting a very performant drawing engine to API level 1. And all that while maintaining a dead simple API.


The "engine" used in this library uses native Canvas API calls which makes even completely re-drawing without any caching blazing fast. The average draw time for the 1500+ clip art icons listed above is a wopping 0.05ms / icon. Yes, that's not even 1% of your frame time.

As the generated code is all Java, the generated class is compiled and minified by ProGuard which means on average 0.9kB is added to your .apk file for each SVG you generate. If you choose to include the Drawable code an extra 0.5kB will be added per SVG. So the size overhead varies from 0.9kB to 1.4kB.
This is once again based on the 1500+ clip art icons. Using complex SVGs with many paths and shapes will result in a bigger file. You can however assume it won't be bigger than twice the size of the original SVG.


This SVG To Android convertor was made as a personal project and most importantly a proof that SVGs can be used performantly on any android API version. Due to its nature it most definitely contains a few bugs here and there. If you want to report a bug, suggest an improvement or request a new feature don't hesitate to contact me!

Thank you for your feedback!
Something went wrong, try again later.