From acbadfc9b0c2c54cc0848f61f700e80c0412c4a7 Mon Sep 17 00:00:00 2001 From: wpp <58198665+879356503@users.noreply.github.com> Date: Tue, 22 Apr 2025 19:18:34 +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 --- .../main/ets/entryability/EntryAbility.ets | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/entry/src/main/ets/entryability/EntryAbility.ets b/entry/src/main/ets/entryability/EntryAbility.ets index a1843d5..5d6b5dd 100644 --- a/entry/src/main/ets/entryability/EntryAbility.ets +++ b/entry/src/main/ets/entryability/EntryAbility.ets @@ -73,6 +73,12 @@ export default class EntryAbility extends UIAbility { windowObj.on('windowSizeChange', (windowSize) => { this.updateBreakpoint(windowSize.width); }) + windowObj.setWindowLayoutFullScreen(true).then(() => { + hilog.info(0x0000, TAG, 'Succeeded in setting the window layout to full-screen mode.'); + }).catch((err: BusinessError) => { + hilog.error(0x0000, TAG, + `Failed to set the window layout to full-screen mode, err code: ${err.code}, message: ${err.message}`); + }); } catch (error) { const err = error as BusinessError; hilog.error(0x000, TAG, `onWindowStageCreate catch err, code: ${err.code}, message: ${err.message}`); @@ -87,19 +93,6 @@ export default class EntryAbility extends UIAbility { return; } hilog.info(0x0000, TAG, 'Succeeded in loading the content.'); - try { - let windowClass: window.Window = windowStage.getMainWindowSync(); - let isLayoutFullScreen = true; - windowClass.setWindowLayoutFullScreen(isLayoutFullScreen).then(() => { - hilog.info(0x0000, TAG, 'Succeeded in setting the window layout to full-screen mode.'); - }).catch((err: BusinessError) => { - hilog.error(0x0000, TAG, - `Failed to set the window layout to full-screen mode, err code: ${err.code}, message: ${err.message}`); - }); - } catch (error) { - const err = error as BusinessError; - hilog.error(0x000, TAG, `Set window layout to full-screen err, code: ${err.code}, message: ${err.message}`); - } }); let windowClass: window.Window | undefined = undefined; window.getLastWindow(this.context, (err: BusinessError, data) => { -- Gitee