AndroidUtilCode icon indicating copy to clipboard operation
AndroidUtilCode copied to clipboard

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

Open stars-one opened this issue 3 years ago • 1 comments

描述 Bug

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

截图

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

解决方法

BarUtils.setStatusBarColor(CustomWebViewActivity.this, color, true);
//加上下面这两行
ViewGroup contentParent = CustomWebViewActivity.this.findViewById(android.R.id.content);
contentParent.getChildAt(0).setFitsSystemWindows(true);

或者在布局xml的根布局加上下面属性:

android:fitsSystemWindows="true"

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

stars-one avatar Aug 23 '22 08:08 stars-one

实际上测试,是在没有theme设置为NoActionBar才会出现

stars-one avatar Aug 23 '22 15:08 stars-one