View on GitHub

AndroidSVG

SVG rendering library for Android

Release Notes

1.4 (28 May 2019)

  • AndroidSVG can now be safely included in apps targeting SDK 28 or later. Thanks to @brudaswen. (Issue 154).
  • Fixed exception rendering some path arcs. (Issue 155).
  • Gracefully handle bad Base64 data when parsing Data URL images. (Issue 170).
  • Partially fixed bug causing glyph spacing issues in some text. However there is still a bug in Android Lollipop to Oreo with fractional font sizes. (Issue 171).

1.3 (13 August 2018)

Version 1.3 release notes

1.2.2-beta-1 (16 June 2014)

  • Fix <image> elements sometimes not rendering correctly (Issue 25).
  • Fixed NPE in <path> elements with no d attribute (Issue 35).
  • A number of changes to improve parsing speed. Parsing is around 2-3 times faster now.
  • SVGImageView now works better with Graphical Layout editor.
  • SVGImageView now loads and parses SVGs on a background thread.
  • Experimental script to build .aar files for Android Studio.

1.2.1 (1 February 2014)

Apologies to everyone for taking so long to release these fixes.

You can download the new release at Bitbucket. If you are a maven user, the release is now available from the central repository.

  • Made parsing of path definitions more robust
  • Fixed a bug with <line> elements that used percentage coordinates.
  • Fixed parsing of paths with commas between coordinate sets ( Issue 13 ).
  • Fixed bad rendering of markers with no viewBox attribute ( Issue 14 ).
  • Transparently support zipped SVG files (.svgz) ( Issue 15 ).
  • Added an SVG.getFromResource() variant that takes a Resource instead of Context ( Issue 16 ).
  • Several improvements to SVGImageView (Issue 20, Issue 21 and Issue 22).
  • Fixed bug with the positioning of nested <svg> elements when they don't have a viewBox.
  • Made SVG.getVersion() a static method so it can be called without having to load an SVG.
  • Added setSVG() method to SVGImageView.
  • Allow numbers (floats) in rgb() colour components.

1.2.0 (16 July 2013)

  • This version has some significant API changes.
    • The SVG.renderToX() and SVG.renderViewToX() methods have been simplified. There are now fewer variants.
    • A number of methods have been added that allow you to read and set the attributes of the root <svg> element. The attributes that can be accessed are width, height, preserveAspectRatio and viewBox. So for example, if you wanted to force an SVG to stretch to fit your canvas, you can do the following:
    • my_svg.setDocumentWidth("100%");
      my_svg.setDocumentHeight("100%");
      my_svg.setDocumentPreserveAspectRatio>PreserveAspectRatio.STRETCH);
      
  • Added support for the following SVG 1.2 Tiny features.
    • The <solidColor> element
    • The viewport-fill and viewport-fill-opacity style properties.
    • The vector-effect property (non-scaling-stroke).
    • The <switch> conditional attributes requiredFormats and requiredFonts.
    • xml:id
  • Errors in the way width and height were handled in the root <svg> element have been fixed. I have also fixed how the <svg> viewport is calculated. This means that some SVGs will render differently (ie correctly) in this version. In particular I was being overly enthusiastic with my scaling. Some files that used to scale to fit the viewport, now will not.
  • The DPI value used to convert real world units such as "cm" or "pt" now always defaults to 96. This follows the recommendation of the CSS specification and means that rendering will now better match the way browsers render SVG files. You can override the DPI setting using the SVG.setRenderDPI() method.
  • The xml:space attribute is now supported.
  • Switched to using Doclava to generate the Javadocs.
  • Added support for the preserveAspectRatio attribute in <view> elements.
  • Added a custom View class for displaying SVG images in your layouts.

1.1.182 (8 Mar 2013)

  • Added CSS support (<style> element) meaning that SVG files generated by Corel Draw are now supported.
  • Fixed handling of <title> and <desc> elements. The parser was not allowing for the fact that the contents of these elements may be spread over multiple lines and may contain other tags. We now extract the entire textual content of the element. Child tags will be stripped but their text content will be included in the returned string.

1.0.170 (3 Feb 2013)

Initial release.