How to enable a PagerSnapHelper to snap in both directions in a RecyclerView?

Viewed 9316

I've attached a PagerSnapHelper to a RecyclerView with a Horizontal LinearLayoutManager using below code.

SnapHelper snapHelper = new PagerSnapHelper();
snapHelper.attachToRecyclerView(myRecyclerView);

However, when I perform scroll, snapping happens only in one direction. i.e. it snaps to next item on a right swipe but doesn't snap to previous item on a left swipe.

Is this the default behavior? Could I override this to enable snapping to previous item as well on a left swipe?

Any pointers here would be of great help. Thanks!

1 Answers
Related