From 9b012b0d714bd75f4aa444ee8e3d3e7cc47d55da Mon Sep 17 00:00:00 2001 From: wpp <58198665+879356503@users.noreply.github.com> Date: Wed, 23 Apr 2025 09:50:40 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=84=E8=8C=83=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/entryability/EntryAbility.ets | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/entry/src/main/ets/entryability/EntryAbility.ets b/entry/src/main/ets/entryability/EntryAbility.ets index 9c5a139..0d332c6 100644 --- a/entry/src/main/ets/entryability/EntryAbility.ets +++ b/entry/src/main/ets/entryability/EntryAbility.ets @@ -67,7 +67,13 @@ export default class EntryAbility extends UIAbility { windowStage.getMainWindow().then((windowObj: window.Window) => { windowObj.on('windowSizeChange', (windowSize) => { this.updateBreakpoint(windowSize.width); - }) + }); + windowObj.setWindowLayoutFullScreen(true).then(() => { + hilog.info(0x0000, TAG, `%{public}s`, 'Succeeded in setting the window layout to full-screen mode.'); + }).catch((error: BusinessError) => { + hilog.error(0x0000, TAG, '%{public}s', + `UFailed to set the window layout to full-screen mode. code: ${error.code}, message: ${error.message}`); + }); }).catch((error: BusinessError) => { hilog.error(0x0000, TAG, '%{public}s', `Failed to get main window. code: ${error.code}, message: ${error.message}`); @@ -81,13 +87,6 @@ export default class EntryAbility extends UIAbility { return; } hilog.info(0x0000, TAG, '%{public}s', 'Succeeded in loading the content.'); - let windowClass: window.Window = windowStage.getMainWindowSync(); - windowClass.setWindowLayoutFullScreen(true).then(() => { - hilog.info(0x0000, TAG, `%{public}s`, 'Succeeded in setting the window layout to full-screen mode.'); - }).catch((error: BusinessError) => { - hilog.error(0x0000, TAG, '%{public}s', - `UFailed to set the window layout to full-screen mode. code: ${error.code}, message: ${error.message}`); - }); }); } -- Gitee