2016-06-13 32 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