1 个回答

1、获取布局避让遮挡的区域

let type = window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR; // 以导航条避让为例 
let avoidArea = windowClass.getWindowAvoidArea(type); 
// 此处获取的单位为px,需转为vp 
let bottomRectHeight = px2vp(avoidArea.bottomRect.height); // 获取到导航条区域的高度 
console.log("bottomRectHeight is " + bottomRectHeight);

2、还可以采用采用组件安全区方案,即不设置窗口全屏,这种场景下,针对底部的页签部分,Navigation组件和Tabs组件默认实现了页签的延伸处理,需要保证Navigation和Tabs组件的底部边界和底部导航条重合即可,参考:https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/arkts-develop-apply-immersive-effects-V5\#section15107174585619

文档链接如下:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-window-V5

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进