Android dpi on the Galaxy Tab vs the Nook
I have large-mdpi layouts for my app that work great on the Nook, but are unusable on the Galaxy Tab (icons huge, some layouts go off the screen, etc.)
Both devices have a resolution of 1024x600 and a screen size of 7 inches. According to my calculations that means they both should have a density of 169dpi.
However, through research and debugging I've f开发者_如何学编程ound that the galaxy tab actually has a density of 240dpi (confirmed Nook's is 169dpi). I now have 2 points of confusion:
1.) I thought dpi was calculated from resolution and size. What am I missing?
2.) I expected layouts/images to appear smaller/sharper on higher density displays. Actually if I am doing things correctly in Android, images should appear the same size since I have hdpi drawables. But on the galaxy tab, everything looks huge.
Thanks for any help!
The Galaxy Tab isn't the only device that has problems with inaccurate reporting of density/size. The Nook Color is MDPI-Large, while the Nook Tablet is MDPI-XLarge. They're both the EXACT same size and density.
I think for small developers, it's a cost/reward balance - you can only put time into fixing the specialty cases for the most popular platforms. In my case I just didn't include XLarge resources, which makes things look fine for Nook Tablet but doesn't look as good on my Xoom.
A few other Nook-specific gotchas I found: http://www.projectjourneyman.com/android-alternate-market-review-nook-store-2
The galaxy tab does not follow android procedure:
"The original Samsung Galaxy Tab is an interesting case. Physically it is a 1024x600 7” screen and thus classified as “large”. However the device configures its screen as hdpi, which means after applying the appropriate ⅔ scaling factor the actual space on the screen is 682dp x 400dp. This actually moves it out of the “large” bucket and into a “normal” screen size. The Tab actually reports that it is “large”; this was a mistake in the framework’s computation of the size for that device that we made. Today no devices should ship like this."
so: 1) You are correct. 2) the Galaxy tab is a "large" screen with hdpi density. So you can't go by screen size. However, you can specify different resources for normal dpi and hdpi. However, really if you just use dp values instead of px, your layouts should all appear fine.
精彩评论