pents90 / svg-android

Support for scalable vector graphics in Android
773 stars 367 forks source link

Does not draw with Android 4.1 #7

Open shnrch opened 11 years ago

shnrch commented 11 years ago

Hi everyone!

I am using the library successfully in my apps and I really like it. But unfortunately it seems that something is different with Android 4.1 - the canvas elements parsed from svg files does not come up, while it is working fine with a different device.

Any suggestions on this? Since I haven't seen any complains by other people it still ma be a problem related with my svg files or the rest of the code I am using to display..

Steffen

pents90 commented 11 years ago

Hi, this is because of a bug with the Android hardware acceleration. See here for the solution: http://stackoverflow.com/questions/13987288/svg-image-not-visible-in-android-3-0-with-same-code/13992014#13992014

schvenk commented 11 years ago

Is this still an issue on 4.1/4.2? And, if you have to turn off hardware acceleration what's the impact on performance?

pents90 commented 11 years ago

Yes, the issue seems to remain on the latest versions of Android. In fact, there are reasons to believe that there will be no fix coming, even though it seems insane that the Android team would be satisfied with having part of their API permanently broken when hardware acceleration is turned on, especially as nearly all new phones default to using hardware acceleration. Note that you can turn off hardware acceleration just for a specific view. The performance can still be good. We wrote the Androidify app using this library and it performs well even on older devices.

schvenk commented 11 years ago

Thanks for the clarification. I'd be looking to use it to draw the background of items in a ListView that may contain a fair number of items...any sense for whether it would be a performance issue there, vs. using PathShape or something? I love the idea of being able to draw stuff in Illustrator and just drop it in...

pents90 commented 11 years ago

If it's just going to be a static drawing back there, should be fine. There's probably even a way to convert it into a bitmap upon layout. Then you can get full hardware acceleration.