Understanding Samsung Galaxy Tab screen density

STeN picture STeN · Aug 13, 2011 · Viewed 18.7k times · Source

One would say that if the Galaxy Tab screen resolution (in portrait mode) is 600px and the screen width is 3.55inch, the screen density would be 600/3.55 = 169 dpi. Knowing that and keeping in mind the way the device independent pixels (dp) is computed (http://developer.android.com/guide/practices/screens_support.html):

px = dp * (dpi / 160);
600 = dp * (169 / 160);
dip = 568

So drawing a horizontal line of 568dp (device independent pixels) width starting at position 0 must exactly match the width of the screen. But if you try this on device you will find that the screen width is 400dp. I will use the same formula again but for getting dpi:

600 = 400 * (dpi / 160);
dpi = 240

So having the 240dpi, 3.55inch screen width and 600pixels, does it mean that one physical pixel is composed of more ‘dots’ otherwise the parameters corresponds to the width of 852pixel (3.55*240).

I thought that dpi means dots per inch, which is pixels per inch. But this seems to not be true...

Added later:
This (http://developer.android.com/guide/topics/resources/more-resources.html#Dimension) says:

160dp is always one inch regardless of the screen density

Which is not true. Just check the measurement source from this: Difference between android dimension: pt and dp

Added even later:
The reason I am asking is that violating the rule that 160dp = 1inch leads to the fact that when specifying the control width to e.g. 320dp it will cover on Galaxy Tab much bigger portion that that really necessary and much bigger then what you would expect from 600x1024px screen...

Thanks for clarification BR STeN

Answer

Pedro Loureiro picture Pedro Loureiro · Aug 13, 2011

Galaxy Tab (7") doesn't report its real density. To understand this issue, read the following article:

http://realmike.org/blog/2010/12/21/multiple-screen-sizes-with-processing-for-android/

Apparently, that’s also what Samsung found when they made the Galaxy Tab. The Galaxy Tab has a 7″, 1024×600 screen with 170 dpi. Yet, the Tab does not report its density as “mdpi” but as “hdpi”, so the layout looks exactly as in the second screenshot. If they used “mdpi”, the icons would be .28″ wide, with “hdpi”, they are .42″ wide—not a big deal, and I must admit, the layout does look prettier this way.

The article contains some images that will make you understand the problem.