is AdapterView Top - Android User Interface

Android examples for User Interface:AdapterView

Description

is AdapterView Top

Demo Code


import android.view.View;
import android.widget.AdapterView;

public class Main {
  private static boolean isAdapterViewTop(AdapterView adapterView) {
    if (adapterView != null) {
      int firstVisiblePosition = adapterView.getFirstVisiblePosition();
      View childAt = adapterView.getChildAt(0);
      if (childAt == null
          || (firstVisiblePosition == 0 && childAt.getTop() == 0)) {
        return true;
      }/* w  w  w.  ja  v a2s .c  o  m*/
    }
    return false;
  }
}

Related Tutorials