Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to detect Android ListView Scrolling stopped?

I'm trying to do something after scrolling stopped.So, I tried using OnScrollListener#onScrollStateChanged(SCROLL_STATE_IDLE) to detect when the scrolling stopped(either TOUCH_SCROLL or FLING)(at 1.5 it's runs as i expect). But when it runs on 2.0, onScrollStateChanged can't received the event after releasing the finger.Is there any callback or anyway to detect that event?

like image 617
koji lin Avatar asked Nov 20 '09 04:11

koji lin


People also ask

How to detect scroll up and scroll down in Android?

You can use Scroll listener to detect scroll up or down changes in RecyclerView . RecycleView invokes the onScrollStateChanged() method before onScrolled() method.

How to check if ScrollView is Scrolling Android?

Do you know if it is possible to know if an Android Widget ScrollView can scroll? If it has enough space it doesn't need to scroll, but as soon as a dimension exceeds a maximum value the widget can scroll.

How do I know my scroll end in flutter?

I used NotificationListener that is a widget that listens for notifications bubbling up the tree. Then use ScrollEndNotification , which indicates that scrolling has stopped.

Is List view scrollable by default?

ListView itself is scrollable.


1 Answers

Try using the setOnScrollListener and implement the onScrollStateChanged with scrollState == 0 ... do what you need to do...

setOnScrollListener(new OnScrollListener() {     public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {         // TODO Auto-generated method stub     }      public void onScrollStateChanged(AbsListView view, int scrollState) {         if (scrollState == OnScrollListener.SCROLL_STATE_IDLE) {             Log.i("a", "scrolling stopped...");         }     } }); 
like image 158
Vidar Vestnes Avatar answered Sep 16 '22 16:09

Vidar Vestnes