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();
}
}
}
}