
回复
本文原创发布在华为开发者社区。
本示例通过windowClass.setWindowLayoutFullScreen设置页面是否全屏。
let windowClass = AppStorage.get("mainWindow") as window.Window
// 1. 设置窗口全屏
windowClass.setWindowLayoutFullScreen(true)
.then(() => {
hilog.info(0x0000,'test','Succeeded in setting the window layout to full-screen mode.');
})
.catch((err: BusinessError) => {
hilog.error(0x0000,'test','Failed to set the window layout to full-screen mode. Cause:' + JSON.stringify(err));
});
let windowClass = AppStorage.get("mainWindow") as window.Window
// 1. 关闭窗口全屏
windowClass.setWindowLayoutFullScreen(false)
.then(() => {
hilog.info(0x0000,'test','Succeeded in setting the window layout to full-screen mode.');
})
.catch((err: BusinessError) => {
hilog.error(0x0000,'test','Failed to set the window layout to full-screen mode. Cause:' + JSON.stringify(err));
});