Nested ViewPager with overscroll

672 Views Asked by At

I have one ViewPager inside another ViewPager. Also, I don't want the child ViewPager to change the position of the parent ViewPager.

So, I implemented my own ViewPager with the following overridden method:

@Override
protected boolean canScroll(View v, boolean arg1, int arg2, int arg3, int arg4) {

    if(v != this && v instanceof ViewPager {

        return true;
    }
    return super.canScroll(v, arg1, arg2, arg3, arg4);
}

This works perfectly.

Now, I want to achieve the native over-scroll edge effect on the child ViewPager when the ViewPager reaches the last element.

The problem is that I have overridden the canScroll() method to return true, so the edge-effect on over scroll gets disabled. Is there any way to achieve this?

0

There are 0 best solutions below