在我的应用程序中,我支持手机/平板电脑的外形尺寸并拥有单独的布局,我使用选择器“layout”(用于手机)、“layout-sw600dp”(用于平板电脑)。
以下是详细信息:
http://android-developers.blogspot.in/2011/07/new-tools-for-managing-screen-sizes.html
Typical numbers for screen width dp are:
320: a phone screen (240x320 ldpi, 320x480 mdpi, 480x800 hdpi, etc).
480: a tweener tablet like the Streak (480x800 mdpi).
600: a 7” tablet (600x1024).
720: a 10” tablet (720x1280, 800x1280, etc).
我有一个 Nexus 4 手机,以下是它的属性
Size: 4.7 inches
Resolution: 768 x 1280 pixels
DPI: 318
dp: 386
Here is the dp calculation
dp = (px * 160)/dpi
dp = (768 * 160)/318
当我在 dp 计算公式中使用 768 px 时,dp 值为 386,但当我通过 1280 px 时,dp 值为 644。
有了以下理解,我认为 Nexus 4 景观会从 sw600dp 读取布局,但事实并非如此。
由于分辨率为宽 X 高,旋转设备时会反转。
我认为这是 sw 选择器与 3.2 之前的大型、xlarge 扇区相比的即兴创作。