简体   繁体   中英

How to listen if listView is scrolling bottom to up?

I would like to listen to if list view is scrolling from bottom to up.

I have tried many work around's but couldn't get the logic for this. The answer on this post did not help me either and also answer on this post helped me to detect if listView is scrolled, (no idea weather it's top to bottom or bottom to top). Can any one help me to detect if list view is scrolled up (bottom to up)

Thanks.

I've edited the snippet from the second post:

public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
    if(currentFirstVisibleItem > firstVisibleItem){
        //scrolling to top of list
    }else if (currentFirstVisibleItem < firstVisibleItem){
        //scrolling to bottom of list
    }

    this.currentFirstVisibleItem = firstVisibleItem;
    this.currentVisibleItemCount = visibleItemCount;        
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM