Bitmap到底占多大内存

学习自

https://mp.weixin.qq.com/s?__biz=MzA3NTYzODYzMg==&mid=403263974&idx=1&sn=b0315addbc47f3c38e65d9c633a12cd6&scene=21#wechat_redirect

由xxhdpi这种文件夹控制,称之为density1

由机型控制,称之为density2(斜长/屏幕寸号)

这两者决定了一张图在内存中转化成的Bitmap实际的width、height

xWidth = (width * (density1 / density2) + 0.5)

xHeight = (height * (density1 / density2) + 0.5)

所以wholeAllocByte = xWidth * xHeight * 每个像素点的占用字节

猜你喜欢

转载自blog.csdn.net/qq_36523667/article/details/81183397