Auto scroll and snapping in scrollview

Hey guys, I want to make a horizontal scrollable Level selection screen. For this i used the scrollview with Lay-out grid. It works all fine so far, however there are two things I feel like I am missing.

  1. when stopping to swipe between two cards, the selection should snap to the card closest to the center of the screen.
  2. when tapping on a card that is not centered but at the edge of the screen I would like the scrollview to scroll to that card.

Can anyone help me or guide me on how to achieve this ?


if you find an answer please share with me and thank you