How to check if a RecyclerView
is scrollable, ie, there are items below/above the visible area
I have a dropdown in my recycler view which works by using
boolean isScrollable() {
LinearLayoutManager layoutManager = (LinearLayoutManager) mRecyclerView.getLayoutManager();
int itemCount = mRecyclerView.getAdapter().getItemCount();
return !(itemCount == 0 ||
(layoutManager.findFirstCompletelyVisibleItemPosition() == 0 &&
layoutManager.findLastCompletelyVisibleItemPosition() == itemCount - 1));
}