获取状态栏高度可以参考文档:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-window-V5\#getwindowavoidarea9demo参考如下:private getStatusBarHeight() { window.getLastWindow(getContext(this), (error, topWindow) => { if (topWindow) { let area = topWindow.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM); let statusBarHeight = area.topRect.height } }) }
获取状态栏高度可以参考文档:
https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-window-V5\#getwindowavoidarea9
demo参考如下: