added in version 25.1.0
belongs to Maven artifact


public class PagerSnapHelper
extends SnapHelper


Implementation of the SnapHelper supporting pager style snapping in either vertical or horizontal orientation.

PagerSnapHelper can help achieve a similar behavior to ViewPager. Set both RecyclerView and the items of the RecyclerView.Adapter to have MATCH_PARENT height and width and then attach PagerSnapHelper to the RecyclerView using attachToRecyclerView(RecyclerView).


Public constructors


Public methods

int[] calculateDistanceToFinalSnap(RecyclerView.LayoutManager layoutManager, View targetView)

Override this method to snap to a particular point within the target view or the container view on any axis.

View findSnapView(RecyclerView.LayoutManager layoutManager)

Override this method to provide a particular target view for snapping.

int findTargetSnapPosition(RecyclerView.LayoutManager layoutManager, int velocityX, int velocityY)

Override to provide a particular adapter target position for snapping.

Protected methods

LinearSmoothScroller createSnapScroller(RecyclerView.LayoutManager layoutManager)

This method is deprecated. use createScroller(LayoutManager) instead.

Inherited methods

From class