-->

Drawables and Layouts for Galaxy Tab and Motorola

2020-06-29 08:26发布

问题:

I'm testing my app at Galaxy Tab and Motorola XOOM emulator skins, and I can't understand, why the drawables are taken from the wrong folders. I have drawable-xhdpi folder, where I store big size pictures. However, Tab takes drawables from drawable-hdpi, and XOOM uses the drawable-mdpi folder. So, how do I manage my resources? Thanks in advance.

In addition, it feels like view sizes defined in sp are not ported properly. I have some views which need to be 80sp x 80sp, on phones with mdpi and hdpi screens they look right, but on tablets they look too small. Why can this be?

回答1:

However, Tab takes drawables from drawable-hdpi, and XOOM uses the drawable-mdpi folder. So, how do I manage my resources?

There is no single "Galaxy Tab" device, so I have no idea which one you are referring to there. The XOOM is an -mdpi device. I would expect that the Galaxy Tab 10.1 would be -mdpi as well. However, in the end, device manufacturers will choose values that they feel deliver the best results for existing applications.



回答2:

GalaxyTab 7" use "-large-hdpi"; XOOM 10.1" use "-xlarge-mdpi".

check this post for details: GalaxyTab, Motorola Xoom Screen Desity and Size



回答3:

I have test with multiple screen resolutions and find out Android use the following qualifier for different screen resolutions: 240x320: -ldpi 320x480: -mdpi 480x800: -hdpi GalaxyTab7.1 inches: -large GalaxyTab10.1 inches: -xlarge

Hope this information is useful for you.



回答4:

Galaxy tab (the old one, running Android 2.x) is indeed not xhdpi. I had success by using the "large" qualifier to identify tablets. Else you can always use an API qualifier such as v11 for Honeycomb only resources.



回答5:

Rather than using the dpi qualifiers you can use screen size qualifiers instead, theres info here on exactly what tags you can use when selecting which resources to use,

http://developer.android.com/guide/topics/resources/providing-resources.html

It's important to understand the difference between dpi and screen size, dpi tends to be high on phones, like a samsung galaxy s2, but on the big 10 inch tablets it tends to be low(which makes sense if you think about it, the phones squeeze more pixels into a smaller space).