Code example for AbsListView

Methods: getChildAt

0
   * - two headers do not overlap 
   */ 
  @Override 
  public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount)
  { 
    View firstChild = view.getChildAt(0);
    if (firstChild != null)
    { 
      View secondChild = view.getChildAt(1);
      ViewsHolder first = (ViewsHolder) firstChild.getTag();
      int cap = 0;
      if (secondChild != null)
      { 
        // Push the previous header if the second is here 
        ViewsHolder second = (ViewsHolder) secondChild.getTag();
        cap = Math.min(0, (int) secondChild.getY() - first.m_header.getHeight());
        // And always reset to 0 the second header, onScroll do not fire for all pixel move. 
        second.m_header.setY(0);
      } 
      // Recompute the Y of the first header 
      float y = Math.max(0, -1 * firstChild.getY() + cap);