SVG to Android Shape

AndroidSvgVector GraphicsShape

Android Problem Overview


I'm wondering how vector drawing in Android with the Shape class may resemble another vector drawing standard.

Since Shape is a Drawable, and Drawables are usually defined as XML, it sounds a lot like the vector drawing commands in SVG.

My question is this: Has anybody created an XSLT transformation, or other mechanism, for converting an SVG drawing description into Android Shapes?

Android Solutions


Solution 1 - Android

Another non-GPL'd library (this one is Apache License 2.0), the one used in Google's Androidify app: svg-android

https://github.com/pents90/svg-android

Solution 2 - Android

Well, not exactly. But I do have ported libsvg to android, which enables you to load SVG files and plot them to a Canvas.

Please check out:

https://launchpad.net/libsvg-android

Solution 3 - Android

The closest thing that I could find was svg4mobile.

While I don't believe that it does transformations to Drawables XML, it does read the svg and make the appropriate calls to the Drawable classes.

Solution 4 - Android

Besides the 2 GPL libraries mentioned, there is a commercial library called TinyLine that implements the SVG Tiny subset, which although more limited may be a better licensing choice, if you want to create a non-GPL'd application.

Solution 5 - Android

Currently some people including me work on it independently.
You may find working solution in these articles:
  Android. ImageView with SVG Support.
  Android ImageView and Drawable with SVG support

Solution 6 - Android

The great AndEngine has an extension for loading SVG and rasterizing it into the texture with any resolution, with color replacement and other great features. Really works. For example you can try a free game by engine author.

Note: The engine best suited for full-screen 2D games and is based on OpenGL 2 view. LGPL

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionBuggieboyView Question on Stackoverflow
Solution 1 - AndroiddgmltnView Answer on Stackoverflow
Solution 2 - AndroidAnton PView Answer on Stackoverflow
Solution 3 - AndroidBuggieboyView Answer on Stackoverflow
Solution 4 - AndroidMarkView Answer on Stackoverflow
Solution 5 - AndroidPavel ChernovView Answer on Stackoverflow
Solution 6 - AndroidAlexey GopachenkoView Answer on Stackoverflow