SVG 到 Android 形状
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2969037/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
SVG to Android Shape
提问by Buggieboy
I'm wondering how vector drawing in Android with the Shape
class may resemble another vector drawing standard.
我想知道在 Android 中使用Shape
该类进行矢量绘图如何可能类似于另一个矢量绘图标准。
Since Shape
is a Drawable
, and Drawables are usually defined as XML, it sounds a lot like the vector drawing commands in SVG.
由于Shape
is aDrawable
和 Drawables 通常被定义为 XML,它听起来很像 SVG 中的矢量绘图命令。
My question is this: Has anybody created an XSLT transformation, or other mechanism, for converting an SVG drawing description into Android Shapes?
我的问题是:是否有人创建了 XSLT 转换或其他机制来将 SVG 绘图描述转换为 Android 形状?
采纳答案by Buggieboy
The closest thing that I could find was svg4mobile.
我能找到的最接近的东西是svg4mobile。
While I don't believe that it does transformations to Drawables XML, it does read the svg and make the appropriate calls to the Drawable classes.
虽然我不相信它会对 Drawables XML 进行转换,但它会读取 svg 并对 Drawable 类进行适当的调用。
回答by dgmltn
Another non-GPL'd library (this one is Apache License 2.0), the one used in Google's Androidify app: svg-android
另一个非 GPL 的库(这是 Apache License 2.0),谷歌的 Androidify 应用程序中使用的库:svg-android
回答by Anton P
Well, not exactly. But I do have ported libsvg to android, which enables you to load SVG files and plot them to a Canvas.
嗯,不完全是。但我确实将 libsvg 移植到了 android,它使您能够加载 SVG 文件并将它们绘制到 Canvas。
Please check out:
请查看:
回答by Mark
Besides the 2 GPL libraries mentioned, there is a commercial library called TinyLinethat implements the SVG Tiny subset, which although more limited may be a better licensing choice, if you want to create a non-GPL'd application.
除了提到的 2 个 GPL 库之外,还有一个名为TinyLine的商业库,它实现了 SVG Tiny 子集,如果您想创建一个非 GPL 的应用程序,它虽然受到更多限制,但可能是更好的许可选择。
回答by Pavel Chernov
Currently some people including me work on it independently.
You may find working solution in these articles:
Android. ImageView with SVG Support.
Android ImageView and Drawable with SVG support
目前包括我在内的一些人独立工作。
您可以在以下文章中找到可行的解决方案:
Android。支持 SVG 的 ImageView。
支持 SVG 的 Android ImageView 和 Drawable
回答by Alexey Gopachenko
The great AndEnginehas an extension for loading SVG and rasterizing it into the texture with any resolution, with color replacement and other great features. Really works. For example you can try a free gameby engine author.
伟大的AndEngine有一个扩展,用于加载 SVG 并将其光栅化为任何分辨率的纹理,具有颜色替换和其他强大功能。真的有效。例如,您可以尝试由引擎作者提供的免费游戏。
Note: The engine best suited for full-screen 2D games and is based on OpenGL 2 view. LGPL
注意:该引擎最适合全屏 2D 游戏并且基于 OpenGL 2 视图。LGPL