svg files rendering in android

2019-05-03 09:36发布

I wrote a program in Android for setting different kinds of images as my background image, but it is not working with svg files. I am not getting any errors, it is not displaying any image and I'm getting a blank screen in my emulator when using svg files. Can any one suggest how to read and display svg files in Android with some code? Or should I convert xml code?

标签: java android svg
3条回答
小情绪 Triste *
2楼-- · 2019-05-03 10:25

Check out Batik. It's a library for creating and parsing SVG in java. It's part of the Apache XML Graphics Project.

Update:

As it turns out, getting Batik to work on Android is non-trivial and there are easier ways to work with SVG on Android. See this answer for more detail.

查看更多
地球回转人心会变
3楼-- · 2019-05-03 10:35

If you can afford to only support Android versions greater than 3, then you could use a Webkit instance to render SVG, as the Android Webkit browser finally has SVG support compiled in.

Alternatively, if you do not require support for scripting or animation, you try using this library: http://code.google.com/p/svg-android/

查看更多
爱情/是我丢掉的垃圾
4楼-- · 2019-05-03 10:36

Another alternative is AndroidSVG (http://code.google.com/p/androidsvg/).

查看更多
登录 后发表回答