图片填充整个页面,如何用图片填充整个页面,上面有白色的区域?


HarmonyOS
2024-10-11 12:08:13
890浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
put_get

窗口默认会避让状态栏与导航栏,设置沉浸式布局即可实现不避让的全屏效果。参考:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-window-V5#setwindowlayoutfullscreen9

示例demo如下:

// EntryAbility.ets  
export default class EntryAbility extends UIAbility {  
  onWindowStageCreate(windowStage: window.WindowStage): void {  
    try {  
      window.getLastWindow(this.context, (err: BusinessError, data: window.Window) => {  
        data.setWindowLayoutFullScreen(true)  
      })  
    } catch {}  
    windowStage.loadContent('pages/Index', (err) => {  
      if (err.code) {  
        hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');  
        return;  
      }  
      hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.');  
    });  
  }  
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
分享
微博
QQ
微信
回复
2024-10-11 16:52:09
相关问题
HarmonyOS 背景图片如何填充满组件
1601浏览 • 1回复 待解决
指定页面区域转化为图片
2642浏览 • 1回复 待解决
HarmonyOS Image组件如何设置填充颜色
950浏览 • 1回复 待解决
填写收获地址智能填充方式
1082浏览 • 1回复 待解决
如何用PixelMap处理图片
3213浏览 • 1回复 待解决
实名购票场景实现智能填充方式
1344浏览 • 1回复 待解决