全局设置全屏
windowStage.getMainWindowSync().setWindowLayoutFullScreen(true)
设置全局背景色
win.setWindowBackgroundColor("#ffc0cb")
在页面关闭沉浸式导航
async aboutToAppear(): Promise<void> {
const win = await window.getLastWindow(getContext())
win.setWindowLayoutFullScreen(false)
获取顶部状态栏高度
px2vp(windowStage
.getMainWindowSync()
.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM)
.topRect.height)
获取底部安全区域高度
px2vp(windowStage
.getMainWindowSync()
.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR)
.bottomRect.height)
扩展安全区域
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])