【问题标题】:Vector Drawables vs Bitmap in terms of RAM (Android)就 RAM 而言,Vector Drawables vs Bitmap (Android)
【发布时间】:2016-06-13 06:48:24
【问题描述】:

就可绘制对象在屏幕上渲染时使用的 RAM 而言,可绘制对象是矢量还是位图有什么不同吗?

我知道向量占用的媒体存储空间更少,但我询问的是渲染它所需的常驻 RAM,因为理论上,它最终仍会被绘制到具有相同像素数量的画布上.

谢谢!

【问题讨论】:

  • VectorDrawable 在内部使用 Bitmap 以加快重新绘制速度,因此它与 BitmapDrawable 并没有真正的不同 ...

标签: android memory vector bitmap ram


【解决方案1】:

来自我前段时间阅读的文档(与您相同的问题)。 这两个选项之间的区别毕竟是发布时 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

【讨论】:

    【解决方案2】:

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

    【讨论】:

      猜你喜欢
      • 2016-08-20
      • 2019-03-11
      • 2016-05-08
      • 2021-09-23
      • 1970-01-01
      • 1970-01-01
      • 2018-10-17
      • 2010-09-18
      • 1970-01-01
      相关资源
      最近更新 更多