HarmonyOS 使用expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP])后,背景图片显示不完整,背景色能显示完整

HarmonyOS
2024-12-24 16:52:22
浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
put_get

需要在EntryAbility中设置窗口全屏,代码如下:

onWindowStageCreate(windowStage: window.WindowStage): void {
  windowStage.loadContent('pages/Index', (err, data) => {
  if (err.code) {
  return;
}
let windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口
// 1. 设置窗口全屏
let isLayoutFullScreen = true;
windowClass.setWindowLayoutFullScreen(isLayoutFullScreen)
  .then(() => {
    console.info('Succeeded in setting the window layout to full-screen mode.');
  })
  .catch((err: BusinessError) => {
    console.error('Failed to set the window layout to full-screen mode. Cause:' + JSON.stringify(err));
  });
});
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.

参考指南:https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/arkts-develop-apply-immersive-effects-V5#section171801550301

分享
微博
QQ
微信
回复
2024-12-24 18:05:24
相关问题
HarmonyOS list组件显示不完整
912浏览 • 1回复 待解决
HarmonyOS JSVM Demo不完整
795浏览 • 1回复 待解决
HarmonyOS 背景图片如何填充满组件
1586浏览 • 1回复 待解决
HarmonyOS 关于开屏背景色
600浏览 • 1回复 待解决
HarmonyOS 弹窗自带背景色
512浏览 • 1回复 待解决
使用js引擎 设置dom背景色无效
1375浏览 • 0回复 待解决
HarmonyOS 如何设置渐变背景色
2260浏览 • 1回复 待解决
如何设置窗口的背景色
2599浏览 • 1回复 待解决
如何设置WebView的背景色
1628浏览 • 1回复 待解决
HarmonyOS 弹框背景色如何自定义图片
645浏览 • 1回复 待解决