is AbsListView To Top - Android User Interface

Android examples for User Interface:ListView

Description

is AbsListView To Top

Demo Code

import android.widget.AbsListView;

public class Main {
  public static boolean isAbsListViewToTop(AbsListView absListView) {
    if (absListView != null) {
      int firstChildTop = 0;
      if (absListView.getChildCount() > 0) {
        firstChildTop = absListView.getChildAt(0).getTop()
            - absListView.getPaddingTop();
      }/*ww  w  . ja  v a  2 s.  c om*/
      if (absListView.getFirstVisiblePosition() == 0 && firstChildTop == 0) {
        return true;
      }
    }
    return false;
  }
}

Related Tutorials