马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
x
EntryAbility.ets
- onWindowStageCreate(windowStage: window.WindowStage): void {
- EntryAbility.windowStage = windowStage
- // Main window is created, set main page for this ability
- this.requestFullScreen(windowStage, this.context)
- windowStage.loadContent('pages/Index', (err, data) => {
- 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. Data: %{public}s', JSON.stringify(data) ?? '');
- });
- }
-
- private requestFullScreen(windowStage: window.WindowStage, context: Context) {
- try {
- let windowClass = windowStage.getMainWindowSync()
- let area = windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM)
- if (area.topRect.height > 0) {
- DeviceInfoUtils.setStatusBarHeight(area.topRect.height)//存储状态栏高度
- windowClass.setWindowLayoutFullScreen(true)
- }
- } catch (err) {
- console.error(`requestFullScreen err = ${err}`)
- }
- }
复制代码 免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |