@ Override public boolean canScrollHorizontally ( int direction ) { if ( getZoomLevel ( ) <= 1.0 ) { return false ; } final Viewport currentViewport = getCurrentViewport ( ) ; final Viewport maximumViewport = getMaximumViewport ( ) ; if ( direction < 0 ) { return currentViewport . left > maximumViewport . left ; } else { return currentViewport . right < maximumViewport . right ; } }
When embedded in a ViewPager this will be called in order to know if we can scroll . If this returns true the ViewPager will ignore the drag so that we can scroll our content . If this return false the ViewPager will assume we won t be able to scroll and will consume the drag