Skip to content Skip to sidebar Skip to footer

Decoding Svg With Androidsvg And Universal Image Loader

I am trying to display svgs with uil. I wrote my own imagedecoder using androidsvg (http://code.google.com/p/androidsvg/) like this: public class SVGImageDecoder implements ImageDe

Solution 1:

Your SVG basically just consists of an <image> element that references a big external image of your entire page. This is not really using SVG in the best way.

Anyway, the answer to your question is as follows:

The reason that your image isn't displaying is that AndroidSVG doesn't know where to find it. You have to create an implementation of the SVGExternalFileResolver class and pass it to SVG using the registerExternalFileResolver() method.

In your implementation of SVGExternalFileResolver you need to override the resolveImage() method. When the render needs to plot the image, it will pass in the filename from the SVG file (in this case "page_0001_img68.png") and you have to load and decode the PNG and pass back a Bitmap object.

Post a Comment for "Decoding Svg With Androidsvg And Universal Image Loader"