Câu hỏi phỏng vấn Android
Câu hỏi

What is the difference between Bitmap and Drawable in Android?

Câu trả lời

The main difference between Bitmap and Drawable in Android is:

  • Bitmap is a specific type of Drawable that represents an image in memory as a grid of pixels[1][2]. Bitmaps are the most common type of Drawable and are used to display static images in your app. They are defined by image files (PNG, JPEG, WebP) stored in the res/drawable/ directory[1][4].

  • Drawable is a general abstraction for something that can be drawn to the screen[2]. It is a superclass that includes Bitmaps as well as other types of drawables like:

    • Nine-patch files (PNG with stretchable regions)[1][3]
    • Shapes defined in XML[1][3]
    • Animations
    • Layers of other drawables
    • Clipping regions
    • Gradients
    • Shapes with colors and gradients[1][3]

So in summary, a Bitmap is a specific type o...

entry

entry

Gợi ý câu hỏi phỏng vấn

senior

When is it necessary, or better to use a SurfaceView instead of a View ?

junior

In what situation should one use RecyclerView over ListView ?

junior

Explain briefly all the Android application components

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào