Android 中的 Bitmap 和 Drawable 有什么区别? [英] What is the difference between Bitmap and Drawable in Android?

查看:38
本文介绍了Android 中的 Bitmap 和 Drawable 有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用谷歌搜索,但找不到任何文章来描述 Android 中 Bitmap 和 Drawable 之间的区别.

I googled but i couldn't find any article to describe about the difference between Bitmap and Drawable in Android.

推荐答案

位图是位图图像的表示(类似于 java.awt.Image).Drawable 是可以绘制的东西"的抽象.它可以是位图(包装为 BitmapDrawable),但也可以是纯色、其他 Drawable 对象的集合或任意数量的其他结构.

A Bitmap is a representation of a bitmap image (something like java.awt.Image). A Drawable is an abstraction of "something that can be drawn". It could be a Bitmap (wrapped up as a BitmapDrawable), but it could also be a solid color, a collection of other Drawable objects, or any number of other structures.

大多数 Android UI 框架喜欢使用 Drawable 对象,而不是 Bitmap 对象.View 可以接受任何 Drawable 作为背景.ImageView 可以显示前景 Drawable.存储为资源的图像被加载为 Drawable 对象.

Most of the Android UI framework likes to work with Drawable objects, not Bitmap objects. A View can accept any Drawable as a background. An ImageView can display a foreground Drawable. Images stored as resources are loaded as Drawable objects.

这篇关于Android 中的 Bitmap 和 Drawable 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆