解决listview底部变化遮盖
来源:互联网 发布:淘宝全球购直播申请 编辑:程序博客网 时间:2024/06/05 06:10
listView.addOnLayoutChangeListener(new OnLayoutChangeListener() {
@Override
public void onLayoutChange(View v, int left, int top, int right,
int bottom, int oldLeft, int oldTop, int oldRight,
int oldBottom) {
System.out.println("layout changed");
if (bottom > 0 && oldBottom > 0 && bottom != oldBottom) {
listView.removeOnLayoutChangeListener(this);
scrollRunnable.setBottomValue(bottom, oldBottom);
scrollRunnable.run();
listView.addOnLayoutChangeListener(this);
}
}
});
ScrollRunnable scrollRunnable = new ScrollRunnable();
class ScrollRunnable implements Runnable {
private int bottomValue;
private int oldBottomValue;
public void setBottomValue(int bottom, int oldBottom) {
this.bottomValue = bottom;
this.oldBottomValue = oldBottom;
}
@Override
public void run() {
final ViewGroup parent = (ViewGroup) listView.getParent();
parent.addOnLayoutChangeListener(new OnLayoutChangeListener() {
@Override
public void onLayoutChange(View v, int left, int top,
int right, int bottom, int oldLeft, int oldTop,
int oldRight, int oldBottom) {
parent.removeOnLayoutChangeListener(this);
// scrool2Bottom();
int result = bottomValue - oldBottomValue;
int scrollValue = result;
// listView.scrollBy(0, -result);
int firstVisiblePosition = listView
.getFirstVisiblePosition();
int firstVisibleTop = listView.getChildAt(0).getTop();
listView.setSelectionFromTop(firstVisiblePosition,
scrollValue + firstVisibleTop);
}
});
}
}
- 解决listview底部变化遮盖
- listview通过滚动摆脱底部button遮盖的问题
- 解决虚拟按键遮盖底部视图的问题
- ListView 显示(数据变化后滚动到)最底部。
- 关于listview 遮盖问题。
- android 解决输入法键盘遮盖布局问题(不适合带listview的布局)
- Android 解决ListView初始化时默认滑动到底部问题
- Android笔记:ListView 显示(数据变化后滚动到)最底部。
- 【Android基础学习】ListView 显示(数据变化后滚动到)最底部。
- 关于聊天室文字聊天(ListView 显示数据变化后滚动到最底部 )
- 解决listView设置 fadingEdge不管用,滑动到底部和底部时两边仍然有蓝色
- android避免弹出软键盘遮盖listview
- android避免弹出软键盘遮盖listview
- android避免弹出软键盘遮盖listview
- android避免弹出软键盘遮盖listview
- android避免弹出软键盘遮盖listview
- 关于listview最后一项i遮盖问题
- Android Theme设置背景图片,底部被导航栏遮盖
- 实现 发送验证码的倒计时功能
- 洛谷2055 [ZJOI2009]假期的宿舍(二分图)
- UML类图几种关系的总结
- 音频视频拍照教程说明
- Direct3D开启垂直同步的三种方法
- 解决listview底部变化遮盖
- 数据库如何处理大数据访问
- qt环境变量配置
- 从电容的名称认识电容的作用
- Timus Online Judge 1018 Binary Apple Tree(树型dp)
- 修改服务器22端口, 以防止暴力破解
- QSqlQuery类无法识别
- android stadio点滴2
- 分享一个超级赞的github的资源整理