Search code examples
androidandroid-layoutscreen-size

What is the real range of dpi for screens?


I want to know the screen size of an Android phone (without using code)

For example: I find that from specs someone has a device with 1080 x 1920 pixels (~445 ppi pixel density)
How would I go from here to figure out which layout his or her phone will support?

From this document, I got:

lpdi = 120 DPI
mdpi = 160 DPI
hdpi = 240 DPI
xhdpi = 320 DPI
xxhdpi = 480 DPI
xxxhdpi = 640 DPI

And this rough estimation below which seems so ridiculous.

enter image description here

Where does the DPI fall, if it is 215 for example?

I want to know the layout size to choose for a particular device that I don't own:

Whether the layout be should be small, medium, large, or extra large ?


Solution

  • There's a bit of confusion between dpi and ppi.
    The correct term should be ppi, but it's dpi by convention.

    So, roughly, we can assume that ppi = dpi, for our purposes.

    For your reference: http://www.fastcodesign.com/3039564/the-difference-between-ppi-vs-dpi-explained-by-a-google-designer

    445 ppi falls in the 480 dpi normalized bucket. 215 ppi falls in the 240 dpi normalized bucket.

    I used the term "bucket" improperly: I should have said "range", to be more clear.

    How would I calculate the ranges?

    I'd say that the range starts from the median between (320 and 480) + 1 and ends at the median between 480 and 640.
    Therefore, for the 480 "bucket", I calculate a range between 401 and 560. And 445 falls here into.

    Note: it's all empyrical.

    The proposed figure on the Android developers site is a poor representation of the concept.
    I prefer to imagine those buckets like adjacent funnels with a "mouth" which is 160 dpi wide and an end which points to a normalized value.

    Here's an image I prepared just to make it even more clear:

    enter image description here