获取底部导航条高度,可以参考如下demo:aboutToAppear(): void { window.getLastWindow(getContext(this), (error, topWindow) => { if (topWindow) { let area = topWindow.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM); let areaBottom = topWindow.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR); //注意:返回的是px值,如果要用vp值需要转换 this.bottomRectHeight = px2vp(areaBottom.bottomRect.height); this.statusBarHeight = px2vp(area.topRect.height); console.log('this.statusBarHeight' + this.statusBarHeight) console.log('this.bottomRectHeight' + this.bottomRectHeight) } }); }
获取底部导航条高度,可以参考如下demo: