mars3142
mars3142

Reputation: 2561

Android ListView end scroll

Is it possible to get triggered, if a ListView has ended scrolling?

I want to implement a check after the user scrolled the ListView. It would be to much checks, if I check this in

AbsListView.OnScrollListener.onScroll()

and it's not needed every pixel movement.

Upvotes: 0

Views: 95

Answers (2)

Lena Bru
Lena Bru

Reputation: 13947

onScrollStateChanged(AbsListView view, int scrollState){

if(scrollState == SCROLL_STATE_IDLE){
//stopped scrolling
}
}

Upvotes: 0

Volodymyr Yatsykiv
Volodymyr Yatsykiv

Reputation: 3211

Try this:

onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount)    {
     if((firstVisibleItem + visibleItemCount) == totalItemCount) {
            //End Scroll
     }
}

firstVisibleItem - is the first item which is visible on the screen, visibleItemCount - count of visible items on the screen.

This should work.

Upvotes: 2

Related Questions