How To Show The SVG Image In The Android Imageview
I have downloaded the svg-android library from the google code and parsed the SVG image using the SVG parser of svg-android as shown but its displaying nothing. SVG CODE
Solution 1:
If you use this svg-android lib (and I think so), then you can see that there are some tutorials.
In short, you should do in this case something like this:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Create a new ImageView
ImageView imageView = new ImageView(this);
// Set the background color to white
imageView.setBackgroundColor(Color.WHITE);
// Parse the SVG file from the resource
SVG svg = SVGParser.getSVGFromResource(getResources(), R.raw.android);
// Get a drawable from the parsed SVG and set it as the drawable for the ImageView
imageView.setImageDrawable(svg.createPictureDrawable());
// Set the ImageView as the content view for the Activity
setContentView(imageView);
}
If you saw this, and do the same, then there may be problems with your SVG. Did you try to open it somewhere else? Or better paste here source of your SVG, please
Post a Comment for "How To Show The SVG Image In The Android Imageview"