public boolean canScrollListDown() { // Ported from AbsListView#canScrollList() which isn't compatible to all API levels final int childCount = mView.getChildCount(); final int itemsCount = mView.getCount(); final int firstPosition = mView.getFirstVisiblePosition(); final int lastPosition = firstPosition + childCount; final int lastBottom = mView.getChildAt(childCount - 1).getBottom(); return lastPosition < itemsCount || lastBottom > mView.getHeight() - mView.getListPaddingBottom(); } }
private boolean canScrollListDown() { // Ported from AbsListView#canScrollList() which isn't compatible to all API levels final int childCount = mView.getChildCount(); final int itemsCount = mView.getCount(); final int firstPosition = mView.getFirstVisiblePosition(); final int lastPosition = firstPosition + childCount; final int lastBottom = mView.getChildAt(childCount - 1).getBottom(); return lastPosition < itemsCount || lastBottom > mView.getHeight() - mView.getListPaddingBottom(); } }
private boolean canScrollList(@ScrollOrientation int direction, AbsListView listView) { final int childCount = listView.getChildCount(); if (childCount == 0) { return false; } final int firstPos = listView.getFirstVisiblePosition(); final int paddingBottom = listView.getListPaddingBottom(); final int paddingTop = listView.getListPaddingTop(); if (direction > 0) { final int lastBottom = listView.getChildAt(childCount - 1).getBottom(); final int lastPos = firstPos + childCount; return lastPos < listView.getChildCount() || lastBottom > listView.getHeight() - paddingBottom; } else { final int firstTop = listView.getChildAt(0).getTop(); return firstPos > 0 || firstTop < paddingTop; } }