Android – Screen size and dpi of bitmaps

androidbitmapdpiscreen-size

I found two approximations of how developer should support bitmaps for different screen sizes. One is this:

ldpi low density 120 dpi

mdpi medium density 160 dpi

hdpi high density 240 dpi

xhdpi extra high density 320 dpi

The other is this:

xhdpi: 2.0

hdpi: 1.5

mdpi: 1.0 (baseline)

ldpi: 0.75

This means that if you generate a 200×200 image for xhdpi devices, you
should generate the same resource in 150×150 for hdpi, 100×100 for
mdpi and finally a 75×75 image for ldpi devices

Does it mean that If I take as a baseline 640×360, I have to make following 4 groups of images:

1) ldpi – size 480×270 pixels and density 120 dpi

2) mdpi – size 640×360 pixels and density 160 dpi

3) hdpi – size 960×540 pixels and density 240 dpi

4) xhdpi – size 1280×720 pixels and density 320 dpi

Best Answer

You are misunderstanding.

The documentation is not saying different things. The second part you reference is telling you how much bigger an image is in relation to the base density of mdpi

e.g xhdpi fits 2x the amount of horizontal and vertical pixels into the same space that mdpi would.

mdpi = 160 dpi (scale factor 1)

xhdpi = 320 dpi (x2 twice as dense as mdpi therefore an image in this folder needs to be twice as high and twice as wide as its mdpi counterpart to appear the same size on an xhdpi screen)

Related Topic