Check if RecyclerView is scrollable
What about
// 1 = down; -1 = up
recyclerView.canScrollVertically(-1)
If you want to check if there is any scrollable space, no matter which direction
cardList.canScrollVertically(1) || cardList.canScrollVertically(-1)
There you go:
public boolean isRecyclerScrollable() {
LinearLayoutManager layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager();
RecyclerView.Adapter adapter = recyclerView.getAdapter();
if (layoutManager == null || adapter == null) return false;
return layoutManager.findLastCompletelyVisibleItemPosition() < adapter.getItemCount() - 1;
}
The idea is to check if the last completely visible element is the last element in the list.
private boolean isScrollable()
{
return mLinearLayoutManager.findLastCompletelyVisibleItemPosition() + 1 ==
mRecyclerViewAdapter.getItemCount();
}
I found an easy solution that works regardless of the position you are in the list:
public boolean isRecyclerScrollable(RecyclerView recyclerView) {
return recyclerView.computeHorizontalScrollRange() > recyclerView.getWidth() || recyclerView.computeVerticalScrollRange() > recyclerView.getHeight();
}