Skip to content

Adding Custom OnScrollListener forcing the section header scrolling #56

@arinjaypatni-infy

Description

@arinjaypatni-infy

Hi,

I have added my custom OnScrollListener which is AbsListView.OnScrolllistener on HeaderListView ,because its own onscrolllistener is required for minimum Api LEVEL 23(my minimum is 15).
It is forcing the section headers scrolling.I want to fix the sectional headrers.Kindly give me some advice.

Below is my custom implementation:-
MyClass implements AbsListView.OnScrollListener
{
@Bind(R.id.receipt_list)
HeaderListView mReceiptsList;

    mReceiptsList.getListView().setOnScrollListener(this);

@OverRide
public void onScrollStateChanged(AbsListView view, int scrollState) {
this.currentScrollState = scrollState;
this.isScrollCompleted();//the method to detect scroll completion
}

@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
    this.currentFirstVisibleItem = firstVisibleItem;
    this.currentVisibleItemCount = visibleItemCount;
    this.totalItemCount = totalItemCount;
}

   /***By this methos I detect if there's been a scroll which has completed***/
private void isScrollCompleted() {
    if (this.currentVisibleItemCount > 0 && this.currentScrollState == SCROLL_STATE_IDLE && this.totalItemCount == (currentFirstVisibleItem + currentVisibleItemCount)) {
 
        if(canLoad) { //class variables to manipulate the data
            pageNumber =pageNumber +1;
            refreshScreen();
        }
    }
}

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions