I'm working on an application that displays someone else's database of images. The images they have are all vector graphics and can be converted to any format, however keeping them in a vector format is good because users will probably want to zoom in closely.
The question is, is there a built-in way to display a vector graphic in Android? The format doesn't matter - we can convert. The current format we're considering is PDF, but given that there's no native PDF support, I'd have to do something pretty complex just to get it working (for example, integrating poppler into my app via the NDK). The alternative is to just convert the vector graphics into a simpler format (JPG, GIF) but I'd rather avoid that.
A VectorDrawable is a vector graphic defined in an XML file as a set of points, lines, and curves along with its associated color information. The major advantage of using a vector drawable is image scalability.
Using vector drawables instead of bitmaps reduces the size of your APK because the same file can be resized for different screen densities without loss of image quality.
1. You need to convert SVG to XML to use in an Android project. 1.1 You can do this with Android SVG to VectorDrawable, but it does not support all the features of SVG, like some gradients.
Check out svg-android - it's a relatively new library and it only supports SVG Basic, but it's the library used to draw Androidify. There are examples on the homepage on how to get a Drawable from an SVG which sems to be what you're looking for.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With