外部拦截
重写ViewGroup的onInterceptTouchEvent()方法
内部拦截
public boolean dispatchTouchEvent(MotionEvent event){
switch(event.getAction()){
case MotionEvent.ACTION_DOWN:
parent.requestDisallowInterceptTouchEvent(true);//父元素不拦截
break;
default:
break;
}
}
??待测??
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, //表示父布局给的参考的大小无限大。(listview无边界)
MeasureSpec.AT_MOST);
super.onMeasure(widthMeasureSpec, expandSpec);
}