Sourabh Sourabh - 1 year ago 136
Android Question

Check if RecyclerView is scrollable

How to check if a

is scrollable, ie, there are items below/above the visible area

I have a dropdown in my recycler view which works by using
. Whenever any of this happens, I want to check if the
is scrollable or not, as I have to adjust another view, a banner like in newsstand, accordingly

Answer Source

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;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download