2016-06-13 48 views
3

就绘制在屏幕上渲染时所使用的RAM而言,如果drawable是矢量或位图,它会产生什么影响?内存中的矢量Drawables与Bitmap(Android)

据我所知,向量占用较少的存储空间,但我想要渲染它所需的RAM,因为从理论上讲,它最终仍然被绘制到具有相同像素量的画布上。

谢谢!

+0

'VectorDrawable'内部使用'Bitmap'更快的重新绘制,因此并没有真正从'BitmapDrawable'不同... – pskink

回答

5

从我前一段时间阅读的文档(与你同样的问题)。 这两个选项之间的不同之处在于,APK文件的大小毕竟是您发布时的大小。 SVG将帮助您节省apk的大小。

The initial loading of a vector graphic can cost more CPU cycles than the corresponding raster image. Afterward, memory use and performance are similar between the two. We recommend that you limit a vector image to a maximum of 200 x 200 dp; otherwise, it can take too long to draw. 正在绘制视图将有这些2选项消耗相同的RAM(内存)。

我的参考来源:https://developer.android.com/studio/write/vector-asset-studio.html#about