gpt4 book ai didi

从不同布局文件夹调用的 Android 资源

转载 作者:行者123 更新时间:2023-11-30 00:56:45 24 4
gpt4 key购买 nike

我有两台具有相同分辨率和 PPI 的安卓设备。但是当我为三星 Tab 4 设备运行我的应用程序时,资源是从正常布局文件夹中调用的。但对于另一台设备 Samsung J Max,它来自 layout-600 文件夹。为什么这些设备的行为不同?任何建议将不胜感激。

最佳答案

你应该检查This Google Article .它指出:

In this context, the Samsung has another little surprise: If you do the arithmetic, its screen has 170 DPI, which is far from the densest among Android devices. Still, it declares itself as “hdpi” (and as having a “large” screen size). The reason is simple: It looks better that way.

这意味着您的 Tab ppi 是 170(不是 220ppi)。结果:800 宽度,170 ppi --> 800/(170/160) > 600。这就是为什么您的 Samsung Tab 4 资源来自文件夹“layout-sw600dp”

关于从不同布局文件夹调用的 Android 资源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40014652/

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