Endless scrolling feature
pablobaldez opened this issue · 6 comments
There is anyway to implement the endless scrolling feature, when any listener would load more itens when the user scroll its list to the end?
With linear LinearLayoutManager I'm used to use the findFirstVisibleItemPosition() method to help me in this implementation, but this method doesn't exists in yours LayoutManager.
How can i do this now?
either in your adapter when you getView the last view, or in your RecyclerView when you've scrolled to/near the bottom.
ok but how can i find the first visible position? where is this method or something like this?
I implemented like this.
if (twoWayView.getLastVisiblePosition() < twoWayView.getAdapter().getItemCount() - 1) {
// load next page
}
nice! thank you
@summers314 that solution makes performance issue.
We have to avoid calling notifyDataSetChanged()
with RecyclerView, specially in onScrolled()
.
But making loading
state can help us to create more clear HTTP requests
when scrolling.