gpt4 book ai didi

android - Drawable 占用的内存是否比 Bitmap 少?

转载 作者:太空宇宙 更新时间:2023-11-03 12:10:34 29 4
gpt4 key购买 nike

我是 Android 新手,刚来这里。

我只知道 Bitmap 逐像素存储图像并且不进行任何压缩。

Drawable和Bitmap一样吗?
或者
同样的图片文件,Drawable 比 Bitmap 占用内存少?

感谢任何回复。

最佳答案

位图是一个DrawableDrawable 不一定是位图。就像所有的拇指都是手指,但并非所有的手指都是拇指。

The API dictates :

Though usually not visible to the application, Drawables may take a variety of forms:

  • Bitmap: the simplest Drawable, a PNG or JPEG image.
  • Nine Patch: an extension to the PNG format allows it to specifyinformation about how to stretch it and place things inside of it.
  • Shape: contains simple drawing commands instead of a raw bitmap,allowing it to resize better in some cases.
  • Layers: a compound drawable, which draws multiple underlyingdrawables on top of each other.
  • States: a compound drawable that selects one of a set of drawablesbased on its state.
  • Levels: a compound drawable that selects one of a set of drawablesbased on its level.
  • Scale: a compound drawable with a single child drawable, whoseoverall size is modified based on the current level.

关于android - Drawable 占用的内存是否比 Bitmap 少?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12107232/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com