沉浸式使用 ImmersionBar
ImmersionBar.with(this)
.fitsSystemWindows(true)
.statusBarColor(color)
.init();
原先使用
ImmersionBar.with(this)
.statusBarDarkFont(true) //状态栏字体是深色,不写默认为亮色
.titleBar(titleView)
.init();
讲一下我的问题 :
activity里面嵌套了三个fragment 在第一个fragment里面的布局底部有一个输入框 按照道理来说应该点击输入框弹起软件盘之后 整个页面都需要向上滚动 但是很可惜 并没有 如下图 弹起之后
一般此问题解决方案
根布局加入此属性 并且用scrollview包裹可自行滚动
android:fitsSystemWindows="true"
清单文件 相对应的activity加入此属性
android:windowSoftInputMode="adjustResize"
方可解决问题
ImmersionBar 框架
此框架中我使用的是布局中加入0dpview进行状态栏适配 如下
activity设置如下:
ImmersionBar.with(this)
.titleBar(titleView)
.init();
这样写就不能再布局中加入 android:fitsSystemWindows="true" 此属性
加入此属性之后状态栏会向下多余出来一部分 如下图
最后的解决办法为:
根布局加入
android:fitsSystemWindows="true"
还有一点就是 ,如果在布局的底部还有布局被顶起来遮盖了editext 请使用线性布局,使用权重分开 (我的解决办法,记录)
清单文件对应的activity加入//暂时 不要加
android:windowSoftInputMode="adjustResize"
最后activity页面加入
ImmersionBar.with(this)
.fitsSystemWindows(true)
.statusBarColor(R.color.titlebar_827_color)
.init();
目前我的问题已经解决 但是项目中涉及此问题较多,所以暂不解决 记录笔记进行备忘