@Override
 public void setHorizontalScrollBarEnabled(boolean horizontalScrollBarEnabled) {
   mList.setHorizontalScrollBarEnabled(horizontalScrollBarEnabled);
 }
  @TargetApi(Build.VERSION_CODES.HONEYCOMB)
  public StickyListHeadersListView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    mTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();

    // Initialize the wrapped list
    mList = new WrapperViewList(context);

    // null out divider, dividers are handled by adapter so they look good with headers
    mDivider = mList.getDivider();
    mDividerHeight = mList.getDividerHeight();
    mList.setDivider(null);
    mList.setDividerHeight(0);

    if (attrs != null) {
      TypedArray a =
          context
              .getTheme()
              .obtainStyledAttributes(attrs, R.styleable.StickyListHeadersListView, defStyle, 0);

      try {
        // -- View attributes --
        int padding =
            a.getDimensionPixelSize(R.styleable.StickyListHeadersListView_android_padding, 0);
        mPaddingLeft =
            a.getDimensionPixelSize(
                R.styleable.StickyListHeadersListView_android_paddingLeft, padding);
        mPaddingTop =
            a.getDimensionPixelSize(
                R.styleable.StickyListHeadersListView_android_paddingTop, padding);
        mPaddingRight =
            a.getDimensionPixelSize(
                R.styleable.StickyListHeadersListView_android_paddingRight, padding);
        mPaddingBottom =
            a.getDimensionPixelSize(
                R.styleable.StickyListHeadersListView_android_paddingBottom, padding);

        setPadding(mPaddingLeft, mPaddingTop, mPaddingRight, mPaddingBottom);

        // Set clip to padding on the list and reset value to default on
        // wrapper
        mClippingToPadding =
            a.getBoolean(R.styleable.StickyListHeadersListView_android_clipToPadding, true);
        super.setClipToPadding(true);
        mList.setClipToPadding(mClippingToPadding);

        // scrollbars
        final int scrollBars =
            a.getInt(R.styleable.StickyListHeadersListView_android_scrollbars, 0x00000200);
        mList.setVerticalScrollBarEnabled((scrollBars & 0x00000200) != 0);
        mList.setHorizontalScrollBarEnabled((scrollBars & 0x00000100) != 0);

        // overscroll
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
          mList.setOverScrollMode(
              a.getInt(R.styleable.StickyListHeadersListView_android_overScrollMode, 0));
        }

        // -- ListView attributes --
        mList.setFadingEdgeLength(
            a.getDimensionPixelSize(
                R.styleable.StickyListHeadersListView_android_fadingEdgeLength,
                mList.getVerticalFadingEdgeLength()));
        final int fadingEdge =
            a.getInt(R.styleable.StickyListHeadersListView_android_requiresFadingEdge, 0);
        if (fadingEdge == 0x00001000) {
          mList.setVerticalFadingEdgeEnabled(false);
          mList.setHorizontalFadingEdgeEnabled(true);
        } else if (fadingEdge == 0x00002000) {
          mList.setVerticalFadingEdgeEnabled(true);
          mList.setHorizontalFadingEdgeEnabled(false);
        } else {
          mList.setVerticalFadingEdgeEnabled(false);
          mList.setHorizontalFadingEdgeEnabled(false);
        }
        mList.setCacheColorHint(
            a.getColor(
                R.styleable.StickyListHeadersListView_android_cacheColorHint,
                mList.getCacheColorHint()));
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
          mList.setChoiceMode(
              a.getInt(
                  R.styleable.StickyListHeadersListView_android_choiceMode, mList.getChoiceMode()));
        }
        mList.setDrawSelectorOnTop(
            a.getBoolean(R.styleable.StickyListHeadersListView_android_drawSelectorOnTop, false));
        mList.setFastScrollEnabled(
            a.getBoolean(
                R.styleable.StickyListHeadersListView_android_fastScrollEnabled,
                mList.isFastScrollEnabled()));
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
          mList.setFastScrollAlwaysVisible(
              a.getBoolean(
                  R.styleable.StickyListHeadersListView_android_fastScrollAlwaysVisible,
                  mList.isFastScrollAlwaysVisible()));
        }

        mList.setScrollBarStyle(
            a.getInt(R.styleable.StickyListHeadersListView_android_scrollbarStyle, 0));

        if (a.hasValue(R.styleable.StickyListHeadersListView_android_listSelector)) {
          mList.setSelector(
              a.getDrawable(R.styleable.StickyListHeadersListView_android_listSelector));
        }

        mList.setScrollingCacheEnabled(
            a.getBoolean(
                R.styleable.StickyListHeadersListView_android_scrollingCache,
                mList.isScrollingCacheEnabled()));

        if (a.hasValue(R.styleable.StickyListHeadersListView_android_divider)) {
          mDivider = a.getDrawable(R.styleable.StickyListHeadersListView_android_divider);
        }

        mList.setStackFromBottom(
            a.getBoolean(R.styleable.StickyListHeadersListView_android_stackFromBottom, false));

        mDividerHeight =
            a.getDimensionPixelSize(
                R.styleable.StickyListHeadersListView_android_dividerHeight, mDividerHeight);

        mList.setTranscriptMode(
            a.getInt(
                R.styleable.StickyListHeadersListView_android_transcriptMode,
                ListView.TRANSCRIPT_MODE_DISABLED));

        // -- StickyListHeaders attributes --
        mAreHeadersSticky =
            a.getBoolean(R.styleable.StickyListHeadersListView_hasStickyHeaders, true);
        mIsDrawingListUnderStickyHeader =
            a.getBoolean(
                R.styleable.StickyListHeadersListView_isDrawingListUnderStickyHeader, true);
      } finally {
        a.recycle();
      }
    }

    // attach some listeners to the wrapped list
    mList.setLifeCycleListener(new WrapperViewListLifeCycleListener());
    mList.setOnScrollListener(new WrapperListScrollListener());

    addView(mList);
  }