Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between Bitmap and Drawable in Android?

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

like image 568
Nikhil C George Avatar asked Jan 20 '12 05:01

Nikhil C George


People also ask

What is bitmap drawable in android?

android.graphics.drawable.BitmapDrawable. A Drawable that wraps a bitmap and can be tiled, stretched, or aligned. You can create a BitmapDrawable from a file path, an input stream, through XML inflation, or from a Bitmap object. It can be defined in an XML file with the <bitmap> element.

What is drawable in android?

A drawable resource is a general concept for a graphic that can be drawn to the screen and which you can retrieve with APIs such as getDrawable(int) or apply to another XML resource with attributes such as android:drawable and android:icon . There are several different types of drawables: Bitmap File.

What is the bitmap image?

bitmap, method by which a display space (such as a graphics image file) is defined, including the colour of each of its pixels (or bits). In effect, a bitmap is an array of binary data representing the values of pixels in an image or display.

What is bitmap in Java?

A bitmap is a mapping from one system such as integers to bits. It is also known as bitmap index or a bit array. The memory is divided into units for bitmap. These units may range from a few bytes to several kilobytes. Each memory unit is associated with a bit in the bitmap.


1 Answers

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.

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.

like image 104
Ted Hopp Avatar answered Sep 28 '22 02:09

Ted Hopp