Example usage for android.widget ListView getListPaddingRight

List of usage examples for android.widget ListView getListPaddingRight

Introduction

In this page you can find the example usage for android.widget ListView getListPaddingRight.

Prototype

public int getListPaddingRight() 

Source Link

Document

List padding is the maximum of the normal view's padding and the padding of the selector.

Usage

From source file:Main.java

public static boolean canScrollList(final ListView lv, int direction) {
    final int childCount = lv.getChildCount();
    if (childCount == 0) {
        return false;
    }//from   ww  w  . j  a v a2  s . co  m

    final int firstPosition = lv.getFirstVisiblePosition();
    final Rect listPadding = new Rect(lv.getListPaddingLeft(), lv.getListPaddingTop(), lv.getListPaddingRight(),
            lv.getListPaddingBottom());
    if (direction > 0) {
        final int lastBottom = lv.getChildAt(childCount - 1).getBottom();
        final int lastPosition = firstPosition + childCount;
        return lastPosition < lv.getCount() || lastBottom > lv.getHeight() - listPadding.bottom;
    } else {
        final int firstTop = lv.getChildAt(0).getTop();
        return firstPosition > 0 || firstTop < listPadding.top;
    }
}