两个listview镶嵌ScrollView无法同时滑动问题
来源:互联网 发布:完美日记化妆品知乎 编辑:程序博客网 时间:2024/05/16 06:04
最近在项目中需要在页面中同时显示两个列表,而且在滑动顶部listview到最后一个item的时候整个页面跟着同时滑动,选择了listview,发现无法同时滑动,显示也出现了问题。
解决此问题的方法有很多种,我的解决如下
很简单,重写listview就ok了:
XWListView类:
public class XWListView extends ListView {
public XWListView(Context context) {
super(context);
}
public XWListView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public XWListView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int mExpandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
super.onMeasure(widthMeasureSpec, mExpandSpec);
}
}
布局文件:
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/activity_upload_queue_actionbar"
android:layout_marginBottom="55dp"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<cn.longmaster.hospital.doctor.ui.consult.XWListView
android:id="@+id/activity_upload_queue_upload_result_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="@null"
android:scrollbars="none" />
<cn.longmaster.hospital.doctor.ui.consult.XWListView
android:id="@+id/activity_upload_queue_list_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="5dp"
android:divider="@null"
android:scrollbars="none" />
</LinearLayout>
</ScrollView>
activity类中还跟的listview一样的使用。
- 两个listview镶嵌ScrollView无法同时滑动问题
- 页面有两个RecyclerView无法正常显示且镶嵌ScrollView滑动异常问题
- 页面有两个RecyclerView无法正常显示且镶嵌ScrollView滑动异常问题
- Abdroid ScrollView镶嵌ListView
- scrollView无法滑动问题
- 安卓学习笔记---实现两个ListView或者GridView在Scrollview中同时滑动,实现ScrollView滑动到顶部
- ListView镶嵌在ScrollView里面
- android中Scrollview中套ListView,高度超出屏幕,listview无法滑动问题
- ScrollView嵌套圆角Listview 实现同时滑动效果
- ListView与ScrollView滑动冲突问题
- Android ScrollView和ListView滑动冲突问题
- ScrollView和ListView滑动冲突问题
- ScrollView嵌套ListVIew两者之间滑动问题
- scrollview嵌套Listview解决滑动问题
- ScrollView嵌套ListView显示和滑动问题
- ScrollView、SwipeRefreLayout、ListView的滑动冲突问题
- listview和scrollview滑动事件冲动问题
- ScrollView中嵌套ListView滑动问题
- 雾计算和边缘计算的区别
- python-026
- Android4.0的ActionBar左上角的返回键怎么监听
- mongodb 分页查询替代skip的方式
- [LeetCode]345. Reverse Vowels of a String
- 两个listview镶嵌ScrollView无法同时滑动问题
- 虚拟机内存使用情况详解
- 用Python学《微积分B》(空间向量)
- codeforces876B Divisiblity of Differences
- 多任务学习进化史
- Alfred每次开机后,都会提示“是否允许访问通讯录”
- jQuery移动端拆红包功能的实现
- 在Oracle上创建SDE空间库的规范化流程
- web四大作用域 转载