public class LinearSnapHelper
extends SnapHelper

   ↳ androidx.recyclerview.widget.RecyclerView.OnFlingListener
     ↳ androidx.recyclerview.widget.SnapHelper
       ↳ androidx.recyclerview.widget.LinearSnapHelper

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

The implementation will snap the center of the target child view to the center of the attached RecyclerView. If you intend to change this behavior then override SnapHelper.calculateDistanceToFinalSnap(RecyclerView.LayoutManager, View).


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.

Inherited methods