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 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

Public methods
open View?

open IntArray?

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

Protected methods
open LinearSmoothScroller?

Inherited functions

Public constructors

<init>

PagerSnapHelper()

Public methods

findSnapView

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

calculateDistanceToFinalSnap

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

findTargetSnapPosition

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

Protected methods

createSnapScroller

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