Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Drawable takes less memory then a Bitmap?

I'm an noob in Android and new here .

I just know that Bitmap store images pixel by pixel and don't do any compress .

Is Drawable same as Bitmap ?
or
For the same image file , a Drawable is takes less memory then a Bitmap ?

Thanks for any response .

like image 310
CuGBabyBeaR Avatar asked Sep 14 '25 15:09

CuGBabyBeaR


1 Answers

A bitmap is a Drawable. A Drawable is not necessarily a bitmap. Like all thumbs are fingers but not all fingers are thumbs.

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 specify information 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 underlying drawables on top of each other.
  • States: a compound drawable that selects one of a set of drawables based on its state.
  • Levels: a compound drawable that selects one of a set of drawables based on its level.
  • Scale: a compound drawable with a single child drawable, whose overall size is modified based on the current level.
like image 116
Wroclai Avatar answered Sep 17 '25 06:09

Wroclai