How to determine the scroll direction of ListView

android, android-layout

Solution

This is called the `Quick Return` pattern. Roman Nurik did a blog post that explains how it works and provided sample code to implement it yourself. You can find that here: https://plus.google.com/u/0/+RomanNurik/posts/1Sb549FvpJt

Problem

I have spent whole day to figure out the direction of scroll of `ListView` but could not find any solution. What I want to achieve is movable header of ListView like "Google Now" search, which goes up while scrolling down and comes back as soon as you scroll up. What I already have tried so far: Implemented custom ListView overrode `onScrollChanged` but it always gives 0 for all attributes. Can anyone put me on the right track.

Original source