androidandroid-recyclerviewandroid-jetpack-composeepoxyandroid-jetpack-compose-list

How to implement 'Snap to center' feature for lists in Jetpack Compose?


In EpoxyRecyclerView with Horizontal LinearLayout there is a Snap to center feature which works like, If i scroll the list with good speed, it keeps on scrolling until it slows down and rests with an item at center. And if I scroll slowly and lift up the finger, then the next item spans/moves to center of screen. One thing you have to understand that, this is not a Pager. Pager automatically snaps the next item only. But I cannot scroll like a free rolling...

You can see this gif as an example

enter image description here

So, I'm looking for such snapping feature in Jetpack Compose. Is this possible yet? If yes, how to achieve this?


Solution

  • If you use Compose 1.3 you can check the SnapFlingBehavior here