[置顶] 沉浸式布局与输入法不兼容问题
2016-07-28 09:02
381 查看
问题:当采用沉浸式布局时,底部的edittext 弹出输入法遮挡住 edittext。
解决方法
1.采用systembartint 替代原有的沉浸式
1.oncrate()方法中加入
if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.KITKAT) {
setTranslucentStatus(true);
}
//创建状态栏管理实例
SystemBarTintManager manager=new SystemBarTintManager(this);
//激活状态栏设置
manager.setStatusBarTintEnabled(true);
manager.setStatusBarTintResource(R.color.title_background);
@TargetApi(19)
private void setTranslucentStatus(boolean on){
Window win = getWindow();
WindowManager.LayoutParams winParams = win.getAttributes();
final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
if (on) {
winParams.flags |= bits;
} else {
winParams.flags &= ~bits;
}
win.setAttributes(winParams);
}
2. 所在activity的根布局中加入 android:fitsSystemWindows="true"
这两部就能解决沉浸式与输入法的问题
解决方法
1.采用systembartint 替代原有的沉浸式
1.oncrate()方法中加入
if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.KITKAT) {
setTranslucentStatus(true);
}
//创建状态栏管理实例
SystemBarTintManager manager=new SystemBarTintManager(this);
//激活状态栏设置
manager.setStatusBarTintEnabled(true);
manager.setStatusBarTintResource(R.color.title_background);
@TargetApi(19)
private void setTranslucentStatus(boolean on){
Window win = getWindow();
WindowManager.LayoutParams winParams = win.getAttributes();
final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
if (on) {
winParams.flags |= bits;
} else {
winParams.flags &= ~bits;
}
win.setAttributes(winParams);
}
2. 所在activity的根布局中加入 android:fitsSystemWindows="true"
这两部就能解决沉浸式与输入法的问题
相关文章推荐
- 基于STM32F4 四轴飞行器 日记 1.0新建工程
- request.getParameterNames()步骤
- static
- 链表:增加结点与删除节点
- HDU Problem 简单计算器【栈】
- 我的文章:开源组件
- JS的节点的基本操作(CRUD)
- eclipse中运行时java application与javaee run on server 他们分别的作用
- yii2的urlManager配置
- 浅谈Web自适应
- MySQ中Lmax_connections的合理设置
- SDUT3330顺序表应用6:有序顺序表查询
- 算法竞赛入门经典(第二版)-刘汝佳-第四章 函数与递归 洪水!
- C#的第8节课
- 208. Implement Trie (Prefix Tree)
- The C++ Programming Language
- UVA 1400 Ray, Pass me the dishes!
- [HDU5727] Necklace [2016 Multi-University Training Contest 1(2016多校联合训练1) E]
- 六款值得推荐的android(安卓)开源框架简介
- H5页面调用拍照上传图片