beginFakeDrag
Start a fake drag of the pager.
A fake drag can be useful if you want to synchronize the motion of the ViewPager2 with the touch scrolling of another view, while still letting the ViewPager2 control the snapping motion and fling behavior. (e.g. parallax-scrolling tabs.) Call fakeDragBy to simulate the actual drag motion. Call endFakeDrag to complete the fake drag and fling as necessary.
A fake drag can be interrupted by a real drag. From that point on, all calls to
fakeDragBy
and endFakeDrag
will be ignored until the next fake drag is started by calling beginFakeDrag
. If you need the ViewPager2 to ignore touch events and other user input during a fake drag, use setUserInputEnabled. If a real or fake drag is already in progress, this method will return false
.
Return
true
if the fake drag began successfully, false
if it could not be started