listView.addHeaderView(viewpage)与listview有冲突的解决办法
重写dispatchTouchEvent方法即可
public class MyViewPager extends ViewPager {
// private static final String TAG = "ViewPager";
public MyViewPager(Context context) {
super(context);
}
public MyViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
// LogHelper.i(TAG, "MyViewPager dispatchTouchEvent, ");
if (getParent() != null) {
getParent().requestDisallowInterceptTouchEvent(true);
}
return super.dispatchTouchEvent(ev);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent arg0) {
// LogHelper.i(TAG, " MyViewPager onInterceptTouchEvent, ");
return super.onInterceptTouchEvent(arg0);
}
}
版权声明:本文为博主原创文章,未经博主允许不得转载。
时间: 2024-11-07 06:29:41