How to put Viewpager behavior inside Recyclerview?

How to put Viewpager behavior inside Recyclerview?

Meet these classes

  1. LinearSnapHelper class
  2. PagerSnapHelper class

LinearSnapHelper class

It is used for similar items and snaps the center of the target child view.

Example:

val snapHelper = LinearSnapHelper()
snapHelper.attachToRecyclervierw(rvView)

PagerSnapHelper class

It is used for full-screen items and behaves the same as viewpager.

Example:

val snapHelper= PagerSnapHelper()
snapHelper.attachToRecyclervierw(rvView)

Thank you :)