How to detect the top scroll in the list

advertisements

I want to hide actionbar on up-scrolling of listview and displaying actionbar again on down-scrolling of listview. Is there any method to detect up and down scrolling of listview? if yes, then please provide some reference.

Any help or guidance will be well appreciated.


API provides such methods, but they are protected, so the best practice in my opinion, is to create wrapper class (extend ScrollView) and make those methods public, particularly onScrollChanged and onOverScroll.

You may look at the following questions to see how to do this:

http://pastebin.com/ePeyswyQ

Detecting the scrolling direction in the adapter (up/down)