最小宽度为的Galaxy S和Galaxy S2
我开发一个Android窗口小部件,需要的Galaxy S 和银河S2 区分。 我几乎读一切关于屏幕大小和密度的文章。 而我需要的,当然,要使用新的限定与新限定的最小宽度。 我的问题是,该sw320dp资格赛的的Galaxy S,也为GALAXY S2。 但我需要的GALAXY S2的另一布局,但不能找到合适的预选赛吧。
I'm developing an Android Widget and need to differentiate between Galaxy S and Galaxy S2. I almost read everything about Screen sizes and densities articles. And I need, of course, to use the new qualifiers with the new qualifier Smallest Width. My problem is, that the sw320dp qualifier match for Galaxy S and also for Galaxy S2. But I need another layout for Galaxy S2, but cant find the right qualifier for it.
的Galaxy S的定义,密度233
在像素屏幕尺寸:480像素X 800像素
Screen Size in Pixels: 480 Pixel x 800 Pixel
在DP屏幕尺寸:329dp x 549dp(原因1DP = 1pixel /(密度/ 160)
Screen Size in dp: 329dp x 549dp (cause 1dp = 1pixel/(density/160)
- >所以限定的 sw320dp 在这里必须匹配。是的它确实
-> so the qualifier sw320dp must match here. and yes it does
的Galaxy S II的定义,密度218
在像素屏幕尺寸:480像素X 800像素
Screen Size in Pixels: 480 Pixel x 800 Pixel
在DP屏幕尺寸:352dp x 587dp(原因1DP = 1pixel /(密度/ 160)
Screen Size in dp: 352dp x 587dp (cause 1dp = 1pixel/(density/160)
- >所以限定的 sw340dp 在这里必须匹配,但否它不
-> so the qualifier sw340dp must match here, but NO it doesnt
(经过测试,在模拟器和真实设备)
(Tested in emulator and on real device)
在可绘是没有问题的,但我的布局,特别是高度和文本大小在这些设备上的不同,所以我真的需要一个特定的布局他们。
The drawables are not the problem, but my layout, especially the height and text sizes are different on these devices, so I really need a specific layout for them.
任何人有一个想法或更多的经验呢?
Anyone has an idea or more experience with it?
屏幕像素密度,由参考材料的定义是:
Screen density, as defined by the reference material is:
屏幕的物理区域内的像素的量;通常被称为分辨率(每英寸点数)。例如,一个低密度屏幕具有给定的物理区域内较少的像素相比,正常或高的密度屏幕。 为了简单起见,Android的组中的所有实际的屏幕密度分为四个广义密度:低,中,高,超高
The quantity of pixels within a physical area of the screen; usually referred to as dpi (dots per inch). For example, a "low" density screen has fewer pixels within a given physical area, compared to a "normal" or "high" density screen. For simplicity, Android groups all actual screen densities into four generalized densities: low, medium, high, and extra high.
低= 120DPI MED = 160dpi 高= 240dpi XHI = 320dpi
low = 120dpi med = 160dpi high = 240dpi xhi = 320dpi
所以银河SII,用218真密度,被分配为240的一个高密度DP计算的。因此,在DP屏幕的宽度为480/240 * 160 = 320
So the Galaxy SII, with a real density of 218, gets assigned a "high" density of 240 in dp calculations. Thus the width of the screen in dp is 480/240*160 = 320.
这很烂,我同意。但它是如何工作的。
This sucks, I agree. But it's how it works.
http://developer.android.com/guide/practices/screens_support.html