gpt4 book ai didi

android - 与 "smallest width 600 dp"选择器混淆

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:07:41 25 4
gpt4 key购买 nike

在我的应用程序中,我支持手机/平板电脑的外形规范,并使用选择器“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 读取布局,但事实并非如此。

由于分辨率是width X Height,当设备旋转时会反转。

我认为这是与 3.2 之前的大型、xlarge 扇区相比,sw 选择器的即兴创作。

最佳答案

正如 Android 文档中所述 here以粗体显示(稍微向下滚动到表 2 的“smallestWidth”部分):

The smallestWidth is a fixed screen size characteristic of the device; the device's smallestWidth does not change when the screen's orientation changes.

关于android - 与 "smallest width 600 dp"选择器混淆,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16105032/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com