1

is there any method that can be called to find out the scrolling is not in action?

or is there any listener that can is set to call when the listview stops scrolling?

Thanks in advance!

akd
  • 6,538
  • 16
  • 70
  • 112

2 Answers2

8
    listView.setOnScrollListener(new OnScrollListener() {
                    @Override
                    public void onScrollStateChanged(AbsListView view, int scrollState) {
                        switch (scrollState) {
                        case OnScrollListener.SCROLL_STATE_IDLE:
                            Log.i("", "here scrolling is finished");
                            break;
                        case OnScrollListener.SCROLL_STATE_TOUCH_SCROLL:
Log.i("", "here scrolling is finished");
                        case OnScrollListener.SCROLL_STATE_FLING:
                            Log.i("", "its scrolling....");
                            break;
                        default:
                            break;
                        }
                    }

Good luck...

Zoombie
  • 3,590
  • 5
  • 33
  • 40
  • This is a good implementation. I am subclassing listview and using a customlistview. disabling some unwanted implementation. I guess I dont have to set a listener when I implement and use this code in my subclassed listview? – akd Aug 24 '12 at 11:54
4

You need to implement OnScrollListener which provides methods that can help you to detect the scrolling position of your ListView. Read this post.

Community
  • 1
  • 1
waqaslam
  • 67,549
  • 16
  • 165
  • 178