Reputation: 22637
I have a list of elements in a size-constrained container, and I'm trying to understand the best way to "scroll" the elements in the container by "page". In other words, I don't want smooth scrolling but rather a "page up" / "page down" sort of behavior.
The complexity is that the elements are not a fixed size so I can't just say render the first N elements, then on scroll, render the next N, etc.
As far as I can tell RecyclerView
et. al. does not provide any support for this behavior, but it seems like a common UX pattern.
Upvotes: 1
Views: 397
Reputation: 1018
I think SnapHelper can help you. try this :
SnapHelper snapHelper = new LinearSnapHelper();
snapHelper.attachToRecyclerView(yourRecyclerView);
or if you want your recycler view to react like a view pager you can use this :
SnapHelper snapHelper = new PagerSnapHelper();
snapHelper.attachToRecyclerView(yourRecyclerView);
Upvotes: 1