Blankj / Blankj/AndroidUtilCode

Android10及以上版本,页面会被沉浸式状态栏遮挡(附上解决方法)

Open
#1,691 1 comment 0 reactions 1 assignee Claimed by @Blankj View on GitHub
bug
Dominant language
Java
Stars
33.6k
Forks
10.6k
PR merge metrics
No merged PRs in 30d

Description

## 描述 Bug

Android10及以上版本,页面会被沉浸式状态栏遮挡

## 截图

![](https://img2022.cnblogs.com/blog/1210268/202208/1210268-20220823163646914-1711712615.png)

图片链接: https://img2022.cnblogs.com/blog/1210268/202208/1210268-20220823163646914-1711712615.png

## 解决方法

```java
BarUtils.setStatusBarColor(CustomWebViewActivity.this, color, true);
//加上下面这两行
ViewGroup contentParent = CustomWebViewActivity.this.findViewById(android.R.id.content);
contentParent.getChildAt(0).setFitsSystemWindows(true);
```
或者在布局xml的根布局加上下面属性:
```
android:fitsSystemWindows="true"
```

希望作者可以抽空调整下,感谢

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.