我可以在Android的Viewpager中使用水平滚动视图吗?
问题描述:
是否可以在android的viewpager内部制作水平scrollview? HorizontalScrollView应该滚动直到到达边缘,然后在下一次滚动时加载下一个viewpager视图.
Is it possible to make a horizontal scrollview inside viewpager in android ?
The HorizontalScrollView should scroll until it reaches its edges, then on next scrolling, should load the next viewpager view.
答
您可以使自定义xxViewpager扩展Viewpager,并覆盖canScroll方法,如下所示:
your can just make custom xxViewpager extends Viewpager, and Override the canScroll method like below:
@Override
protected boolean canScroll(View v, boolean checkV, int dx, int x, int y) {
if (v instanceof HorizontalScrollView) {
return true;
}
return super.canScroll(v, checkV, dx, x, y);
}