Example usage for android.widget ListView getListPaddingBottom

List of usage examples for android.widget ListView getListPaddingBottom

Introduction

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

Prototype

public int getListPaddingBottom() 

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;
    }/*  ww w. jav a  2 s . c  o 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;
    }
}