Example project showing how to handle toolbar w/ tabs on scrolling like in Google Play Music / Play Newsstand
With the release of the Google Design Support Library, it is probably easier to use components like CoordinatorLayout to handle to scroll events (in xml only!).
The original approach is explained in this blog post on Medium.