Understanding Samsung Galaxy Tab screen density
Asked Answered
D

1

8

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

Dejected answered 13/8, 2011 at 9:38 Comment(4)
I think you might be confusing dpi with dip, device independent pixels.Thigh
Hi, can you be more concrete what I am doing wrongly? Where I did a mistake?Dejected
I may have misread you post earlier, but perhaps you want to check <developer.android.com/reference/android/util/…>. I think it might not return the density your expecting from your calculations. I havent checked your math, but maybe it all comes together if density is 160 rather than 169?Thigh
The Android documentation has now been updated to remove the incorrect statement that 160 dp equals 1 inch.Dotdotage
A
9

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.

Anticathexis answered 13/8, 2011 at 10:37 Comment(5)
Hi, good article, but how we then should specify the widgets sizes correctly? Seems that use dp is fine only as long as devices report the real density, not the pseud-density like Galaxy-Tab is doing...Dejected
You should specify it using dp. Galaxy Tab will show your objects larger than it would show if it used the real density, but Samsung believes this achieves a better result. Judging by the images in that post, I agree with Samsung! Also, follow these tips: developer.android.com/guide/practices/…Anticathexis
Okay, agree - anyway the Android documentation is wrong saying 160dp=1inch. This is really misleading. And also it seems that the dpi might not the best way to select drawable sources, since it does not consider screen size when the pseduo-density (logical density) is used - might be something Google can change in the future... I was trying the DisplayMetrics class - it returns the exact physical pixels per inch (i.e. 169 dpi) as well as the logical density.Dejected
I guess they took care of this issue in 3.2 using "Numeric Selectors" instead of "screen size Buckets". Following mentions the problem with Galaxy Tab and Dell Streak : android-developers.blogspot.com/2011/07/…Sectorial
Thanks Developerx - I will go through the blog. Good to hear the 3.x is reflecting this issue.Dejected

© 2022 - 2024 — McMap. All rights reserved.