ScrollView嵌套EditText时ScrollView无法滑动问题
来源:互联网 发布:手机迅雷总是网络异常 编辑:程序博客网 时间:2024/05/16 14:49
点击打开链接
在setContentView()后面加上下面的代码
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
inal ScrollView scrollView= (ScrollView) findViewById(R.id.scrollView);
final View decorView=getWindow().getDecorView();
decorView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
Rect rect=new Rect();
decorView.getWindowVisibleDisplayFrame(rect);
int screenHeight = decorView.getRootView().getHeight();
int heightDifference = screenHeight-rect.bottom;//计算软键盘占有的高度 = 屏幕高度 - 视图可见高度
LinearLayout.LayoutParams layoutParams= (LinearLayout.LayoutParams) scrollView.getLayoutParams();
layoutParams.setMargins(0,0,0,heightDifference);//设置ScrollView的marginBottom的值为软键盘占有的高度即可
scrollView.requestLayout();
}
});
- ScrollView嵌套EditText时ScrollView无法滑动问题
- 解决ScrollView中嵌套EditText无法滑动的问题
- ScrollView嵌套EditText滑动冲突问题
- ScrollView嵌套EditText的滑动冲突问题
- ScrollView中嵌套EditText滑动问题
- ScrollView内嵌套EditText导致EditText无法滑动
- ScrollView内嵌套EditText导致EditText无法滑动
- scrollView无法滑动问题
- 【Android】Scrollview嵌套EditText,使其滑动
- Scrollview嵌套EditText,使其滑动
- Scrollview嵌套EditText,使其滑动
- 解决ScrollView嵌套RecyclerView无法滑动的问题
- Android通用——ScrollView内嵌套EditText导致EditText无法滑动
- ScrollView嵌套EditText,导致EditText显示多行时滑动失效的问题
- ScrollView嵌套EditText,导致EditText显示多行时滑动失效的问题
- ScrollView嵌套Scrollview滑动冲突
- Android ScrollView 嵌套 ScrollView 滑动
- android-ScrollView中嵌套EditText使用问题
- “蓝湖”解锁了“自动切图”功能!
- 图论day2(回家/香甜的黄油/bellman-ford算法的理解)
- CentOS7中如何让Linux在启动时就将CPU分离并将hugepage设置为初始1GB
- MySQL排序检索数据(ORDER BY)
- 新建testng类
- ScrollView嵌套EditText时ScrollView无法滑动问题
- LeetCode: -Dynamic Programming-Continuous Subarray Sum[523]
- 华为防火墙VPN-GRE配置
- 回归
- 复习 activity 的生命周期 手机锁屏时生命周期变化
- 【转】时间复杂度的计算
- Python:视频截取
- LayUI富文本编辑器的使用--数据加载与编辑器创建的先后顺序
- Android中的回调举例解析