Ahmad Raza
Ahmad Raza

Reputation: 2850

HeaderListView with Pull to refresh

This Post is Duplicate of : PullToRefresh list with pinned section header & is it possible to merge stickylistviewheader with crisbanes pulltorefresh?

I need to implement headerListView with pull-to-refresh functionality. I am Googling for possible way to implement it, But still not got any solution.

NOTE: There is a option, Use mergeAdapter to achieve separator, This solution will not work for me, because i need stickyHeader, Not separators.

Thanks,

Upvotes: 0

Views: 1632

Answers (1)

LaSprezz
LaSprezz

Reputation: 71

StickyListHeader works like a charm with ActionBar-PullToRefresh as long as you use the custom Delegate as provided here by Andrew Emery in the answers; that is :

public class StickyListViewDelegate extends AbsListViewDelegate {
    @Override
    public boolean isReadyForPull(View view, final float x, final float y) {
        StickyListHeadersListView sticky = (StickyListHeadersListView) view;
        return super.isReadyForPull(sticky.getWrappedList(), x, y);
    }
}

Integrated like so:

StickyListViewDelegate delegate = new StickyListViewDelegate();
ActionBarPullToRefresh.from(this).theseChildrenArePullable(mListView)
        .useViewDelegate(StickyListHeadersListView.class, delegate)
        .listener(this).setup(mPullToRefreshLayout);

Upvotes: 1

Related Questions