Vector Drawables 与 RAM 方面的位图 (Android)

Vector Drawables vs Bitmap in terms of RAM (Android)

就可绘制对象在屏幕上呈现时使用的 RAM 而言,可绘制对象是矢量还是位图有什么区别?

我知道矢量占用较少的媒体存储空间 space,但我想问的是渲染它所需的驻留 RAM,因为理论上它仍然被绘制到 canvas 最后的像素数量相同。

谢谢!

来自我前段时间阅读的文档(与您相同的问题)。 这两个选项之间的区别在于发布时 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. 在视图中绘制将消耗具有相同 RAM(内存)的这 2 个选项。

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

对简单的形状使用矢量绘图。对复杂结构使用相同的方法会迅速增加 apk 的大小。