Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Understanding Samsung Galaxy Tab screen density

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

like image 314
STeN Avatar asked Aug 13 '11 09:08

STeN


People also ask

What does screen density mean?

To put it simple: Screen size is the physical size of the screen (whether in inch or cm) Screen density is the ratio of how many pixels / area of screen size (that's why the unit is dpi, or dots per inch)

Which are the screen densities in Android?

36x36 (0.75x) for low-density (ldpi) 48x48 (1.0x baseline) for medium-density (mdpi) 72x72 (1.5x) for high-density (hdpi) 96x96 (2.0x) for extra-high-density (xhdpi)

What is 4x pixel density?

In 4x screen (~640 DPI) it takes four times as many pixels (352 x 144 PX) to fill the area of 88 x 36 density-independent-pixels.

What is screen density DPI?

In Android, we have a baseline density of 160 dots-per-inch(dpi). So, for a 160 dpi screen, we have 1 pixel = 1 dp and 320 dpi screen, we have 2 pixels = 1 dp which is 2x.


1 Answers

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.

like image 192
Pedro Loureiro Avatar answered Sep 21 '22 05:09

Pedro Loureiro