I managed to display an SVG using a
WebView
, since that is more than capable of rendering an SVG:webView.loadUrl("file:///android_res/drawable/file.svg"); // point it to the SVG
webView.setBackgroundColor(0x00000000); // set the background to transparent
This makes it render much like a transparent PNG would in an
ImageView
. The only caveat is that the SVGmust use the viewBox
attribute and not use the height
or width
attributes, to ensure it resizes properly.http://stackoverflow.com/questions/18356098/having-issue-on-real-device-using-vector-image-in-android-svg-android
No comments:
Post a Comment