屏幕信息

注意

不推荐使用该组件,也不再支持该组件。

若要检索有关显示区域和折叠功能的信息,你应使用 Jetpack 窗口管理器

或者,使用可自动适应双屏和折叠式设备的以下双屏控件和布局之一。

可以通过 ScreenInfo 组件获取有关设备屏幕状态的详细信息。

getHinge - 返回 Rect 对象中的铰链的坐标。

  • fun ​getHinge​(context: Context): Rect?

isSurfaceDuoDevice - 检查设备是否为 Surface Duo。

  • fun isSurfaceDuoDevice(context: Context): Boolean

getWindowRect - 返回整个设备窗口的坐标。

  • fun getWindowRect(context: Context): Rect

getScreenRectangles - 返回设备的两个屏幕的坐标。

  • fun ​getScreenRectangles​(context: Context): List<Rect>?

isDualMode - 检查应用程序是否处于双屏模式下。

  • fun ​isDualMode​(context: Context): Boolean

getCurrentRotation - 返回屏幕的旋转的常量证书。 根据旋转角度,函数将返回:Surface.​ROTATION_0Surface.ROTATION_90Surface.ROTATION_180Surface.ROTATION_270

  • fun ​getCurrentRotation​(context: Context): Int