Code example for AbsListView

Methods: getChildAt

   * - two headers do not overlap 
  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. 
      // Recompute the Y of the first header 
Experience pair programming with AI  Get Codota for Java