gpt4 book ai didi

android - 如何使用代码确定设备屏幕尺寸类别(小、正常、大、xlarge)?

转载 作者:IT老高 更新时间:2023-10-28 12:50:08 30 4
gpt4 key购买 nike

有没有办法确定当前设备的屏幕尺寸分类,比如小、普通、大、超大?

不是密度,而是屏幕尺寸。

最佳答案

您可以使用 Configuration.screenLayout位掩码。

例子:

if ((getResources().getConfiguration().screenLayout & 
Configuration.SCREENLAYOUT_SIZE_MASK) ==
Configuration.SCREENLAYOUT_SIZE_LARGE) {
// on a large screen device ...

}

关于android - 如何使用代码确定设备屏幕尺寸类别(小、正常、大、xlarge)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5015094/

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