Let's say we the following set of item Views:
View1 -> View2 -> View3 -> ... -> View(n-1) -> View(n)
On classic RecyclerView, View1 would be on first position and View(n) on last. Now I would like to make that circular so after last position we scroll again to first position:
View1 -> View2 -> View3 -> ... -> View(n-1) -> View(n) -> View1 -> View2 -> ...
This at first look seems simple to make but I am not sure how to accomplish that "reset" after View(n). Any advice would be really helpful. Thank you.
Please refer to this solution for ListView. You may write a RecyclerView.Adapter
that has Integer.MAX_VALUE
items. The only difference is that RecyclerView no longer has setSelectionFromTop
method. Instead you should call
recyclerView.getLayoutManager().scrollToPosition(recyclerAdapter.MIDDLE);
in order to scroll the recyclerView to the middle at first.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With