我正在从服务器以字节数组形式提取矢量可绘制对象。我需要在可利用的资源中解析它们以显示视图。我该怎么办?
答案 0 :(得分:0)
您可以使用可以渲染SVG的库。例如androidsvg使用getFromInputStream()方法从字节数组读取svg
/**
* Read and parse an SVG from the given {@code InputStream}.
*
* @param is the input stream from which to read the file.
* @return an SVG instance on which you can call one of the render methods.
* @throws SVGParseException if there is an error parsing the document.
*/
@SuppressWarnings("WeakerAccess")
public static SVG getFromInputStream(InputStream is) throws SVGParseException
{
SVGParser parser = new SVGParser();
return parser.parse(is, enableInternalEntities);
}