lazy-ninja / svg-android

Automatically exported from code.google.com/p/svg-android
0 stars 0 forks source link

svg-android imageview not working #49

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Create an imageview
2. Attach it to RelativeLayout

Like so:
Implement an imageview like so:
ImageView imageView = new ImageView(this); 
SVG svg = SVGParser.getSVGFromResource(getResources(), R.raw.logo); 
imageView.setImageDrawable(svg.createPictureDrawable());
RelativeLayout home_header = (RelativeLayout) findViewById(R.id.home_header);
home_header.addView(imageView);

What is the expected output? What do you see instead?
Image displays

What version of the product are you using? On what operating system?
05-27 11:25:43.950: E/(28492): Can't open file for reading
05-27 11:25:43.960: E/(28492): Can't open file for reading
05-27 11:25:43.980: W/dalvikvm(28492): threadid=1: thread exiting with uncaught 
exception (group=0x40bd41f8)
05-27 11:25:43.980: E/AndroidRuntime(28492): FATAL EXCEPTION: main
05-27 11:25:43.980: E/AndroidRuntime(28492): 
java.lang.UnsupportedOperationException
05-27 11:25:43.980: E/AndroidRuntime(28492):    at 
android.view.GLES20Canvas.drawPicture(GLES20Canvas.java:911)
05-27 11:25:43.980: E/AndroidRuntime(28492):    at 
android.graphics.drawable.PictureDrawable.draw(PictureDrawable.java:73)

Please provide any additional information below.
What am i missing?!

Original issue reported on code.google.com by ke...@kevinlint.com on 27 May 2013 at 6:57

GoogleCodeExporter commented 9 years ago
Try disabling hardware acceleration.  Add the following:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        // Disable hardware acceleration
        imageView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}

Original comment by peter.g....@gmail.com on 30 Apr 2014 at 2:48