PagerSnapHelper

open class PagerSnapHelper : SnapHelper
kotlin.Any
   ↳ androidx.recyclerview.widget.RecyclerView.OnFlingListener
   ↳ androidx.recyclerview.widget.SnapHelper
   ↳ androidx.recyclerview.widget.PagerSnapHelper

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

PagerSnapHelper can help achieve a similar behavior to androidx.viewpager.widget.ViewPager. Set both RecyclerView and the items of the RecyclerView.Adapter to have android.view.ViewGroup.LayoutParams#MATCH_PARENT height and width and then attach PagerSnapHelper to the RecyclerView using attachToRecyclerView(RecyclerView).

Summary

Public constructors

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

Public methods

open IntArray?
calculateDistanceToFinalSnap(@NonNull layoutManager: RecyclerView.LayoutManager, @NonNull targetView: View)

open View?

open Int
findTargetSnapPosition(layoutManager: RecyclerView.LayoutManager!, velocityX: Int, velocityY: Int)

Protected methods

open LinearSmoothScroller?

Inherited functions

Public constructors

<init>

PagerSnapHelper()

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

PagerSnapHelper can help achieve a similar behavior to androidx.viewpager.widget.ViewPager. Set both RecyclerView and the items of the RecyclerView.Adapter to have android.view.ViewGroup.LayoutParams#MATCH_PARENT height and width and then attach PagerSnapHelper to the RecyclerView using attachToRecyclerView(RecyclerView).

Public methods

calculateDistanceToFinalSnap

@Nullable open fun calculateDistanceToFinalSnap(@NonNull layoutManager: RecyclerView.LayoutManager, @NonNull targetView: View): IntArray?

findSnapView

@Nullable open fun findSnapView(layoutManager: RecyclerView.LayoutManager!): View?

findTargetSnapPosition

open fun findTargetSnapPosition(layoutManager: RecyclerView.LayoutManager!, velocityX: Int, velocityY: Int): Int

Protected methods

createSnapScroller

protected open fun createSnapScroller(layoutManager: RecyclerView.LayoutManager!): LinearSmoothScroller?