Android 高度屏幕限定符不起作用

Android height screen qualifier not working

我已经使用此限定符创建了资源文件 "h900dp" 假设屏幕的最小高度为 900dp。

我的设备具有此 DisplayMetrics:

{density=2.0, width=1200, height=1824, scaledDensity=2.0, xdpi=320.842, ydpi=322.966}

我假设这意味着高度是 912dp。

那我的资源文件怎么没有用

感谢

我想你早就想通了,但我在搜索自己时遇到了这个问题。从那以后,我了解到高度限定符不计算状态栏或导航栏,因此当您从总 912dp 中减去这些区域的高度时,很可能您只是错过了 900dp 的高度。

以下是 android 开发网站上 Supporting Multiple Screens 的摘录:

Note: The sizes that you specify using these qualifiers are not the actual screen sizes. Rather, the sizes are for the width or height in dp units that are available to your activity's window. The Android system might use some of the screen for system UI (such as the system bar at the bottom of the screen or the status bar at the top), so some of the screen might not be available for your layout. Thus, the sizes you declare should be specifically about the sizes needed by your activity—the system accounts for any space used by system UI when declaring how much space it provides for your layout.