ListView怎么监听ScrollView中的滚动事件
1个回答
展开全部
这是监听不了的,listview和scrollview不能同时使用
要使用必须设置listview不能滚动public class MyListView extends ListView { public MyListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); // TODO Auto-generated constructor stub } public MyListView(Context context, AttributeSet attrs) { super(context, attrs); // TODO Auto-generated constructor stub } public MyListView(Context context) { super(context); // TODO Auto-generated constructor stub } @Override public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); }
要使用必须设置listview不能滚动public class MyListView extends ListView { public MyListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); // TODO Auto-generated constructor stub } public MyListView(Context context, AttributeSet attrs) { super(context, attrs); // TODO Auto-generated constructor stub } public MyListView(Context context) { super(context); // TODO Auto-generated constructor stub } @Override public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); }
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询