Blankj / Blankj/AndroidUtilCode
获取导航栏高度方法
- Dominant language
- Java
- Stars
- 33.6k
- Forks
- 10.6k
- PR merge metrics
- No merged PRs in 30d
Description
## 描述 Bug
由于安卓12L新增加了任务栏功能,当前获取导航栏高度方法是不是需要兼容下
- AndroidUtilCode 的版本:utilcodex:1.30.1
- 出现 Bug 的设备型号:三星Galaxy Z Fold4
- 设备的 Android 版本:Android 13
## 相关代码
```
int navBarHeight ;
WindowInsetsCompat rootWindowInsets = ViewCompat.getRootWindowInsets(findViewById(android.R.id.content));
if (rootWindowInsets != null) {
int top = windowInsets.getInsets(WindowInsetsCompat.Type.navigationBars()).top;
int bottom = windowInsets.getInsets(WindowInsetsCompat.Type.navigationBars()).bottom;
int height = Math.abs(bottom - top);
if (height > 0) {
navBarHeight = height;
} else {
navBarHeight = BarUtils.getNavBarHeight();
}
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.