Harmony 设置全屏

67 阅读1分钟
  onWindowStageCreate(windowStage: window.WindowStage): void { 
      
      let windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口
  
      windowClass.setWindowLayoutFullScreen(true).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));
    });
  }