有没有适用于Android的Lite SVG查看器?

Taw*_*ani 8 svg android

Android是否支持查看SVG文件或Android平台是否有任何第三方SVG查看器?

Ser*_*m's 3

我满意地在我的应用程序中使用http://code.google.com/p/svg-android/ 。我所有的图形资源都以 svg 格式存储并动态渲染。

现在我正在使用原始项目的分支: https://github.com/japgolly/svg-android

只需将 .java 文件包含到您的项目中并使用它们即可。这个分支对原始代码带来了一些改进。

显然,您需要编写一些代码来构建您自己的 SVG 查看器。但这很简单:

SVG svg = new SVGBuilder()
            .readFromResource(getResources(), R.raw.someSvgResource)
            .build();

Drawable drawable = svg.createDrawable();
imageView.setImageDrawable(drawable);
Run Code Online (Sandbox Code Playgroud)

因此,您所需要的只是 Activity 上的 ImageView 组件。

编辑2013年6月8日:

我建议也尝试这个项目:

http://www.codeproject.com/Articles/136239/Android-ImageView-and-Drawable-with-SVG-Support

有自己的 SVG 解析器。