Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use Horizontal Scrollview Inside a Viewpager in Android?

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.

like image 628
Tejas Avatar asked Nov 24 '25 19:11

Tejas


1 Answers

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);
        }
like image 196
Fooyou Avatar answered Nov 26 '25 11:11

Fooyou