解决方法:
1.自定义ViewPager继承自系统的ViewPager
2.重写canScroll方法
例如:
public class HorizontalCanScrollViewPager extends ViewPager {
public HorizontalCanScrollViewPager(Context context) {
this(context, null);
}
public HorizontalCanScrollViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected boolean canScroll(View v, boolean checkV, int dx, int x, int y) {
if (v instanceof HorizontalListView || v instanceof HorizontalScrollView || v instanceof ViewPager) {
return true;
}
return super.canScroll(v, checkV, dx, x, y);
}
}
网友评论