fakeDragBy

open fun fakeDragBy(@Px offsetPxFloat: Float): Boolean(source)

Fake drag by an offset in pixels. You must have called beginFakeDrag first. Drag happens in the direction of the orientation. Positive offsets will drag to the previous page, negative values to the next page, with one exception: if layout direction is set to RTL and the ViewPager2's orientation is horizontal, then the behavior will be inverted. This matches the deltas of touch events that would cause the same real drag.

If the pager is not in the fake dragging state anymore, it ignores this call and returns false.

Return

true if the fake drag was executed. If false is returned, it means there was no fake drag to end.

Parameters

offsetPxFloat

Offset in pixels to drag by

See also