onWindowStageCreate(windowStage: window.WindowStage): void {
// Main window is created, set main page for this ability
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
windowStage.loadContent('pages/APage', (err) => {
if (err.code) {
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
return;
}
windowStage.getMainWindowSync().setWindowBackgroundColor('#00ff33') ##此处添加
hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.');
});
}
显示与隐藏 可以设置沉浸式,隐藏的话可以退出沉静式,在子窗口打开的页面 aboutToAppear 方法中设置沉浸式
参考链接:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-window-V5\#setwindowlayoutfullscreen9
设置状态栏的背景:SystemBarProperties,参考链接:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-window-V5\#setwindowlayoutfullscreen9
或者使用