Search code examples
androidandroid-layoutandroid-recyclerview

Android: Making the toolbar slide up and down along with the Recycler View


I've been using Phonograph music player for a while and it's a really good looking app in my opinion. It has a very nice sort of header: basically there's the toolbar which slides up and down along with the recycler view hiding behind the status bar when scrolling down and coming back visible when scrolling up, the difference with other toolbars show/hide animations is that this one does not actually have two rigid states (hidden or shown) but instead it can be half covered, 70% covered, 80% covered and so on, it moves at the same speed of the recycler view, it's really different than the ActionBar.hide() .

Little clip to explain what I'm talking about:

http://i.imgur.com/JCIiFAA.jpg

I've searched the web for solutions but I haven't found anything close enough but I think that the Observable Scroll View library might be a good starting point (Have already done some testing but so far it has those 2 rigid states which I don't want).

I am using an activity MainActivity.java and setting its content view to activity_main.xml, how can I achieve that result?

Also how can I make that view pager selector just below the toolbar but sticky?


Solution

  • CoordinatorLayout from Design Support Library is what you are looking for. See Tutorial here https://mzgreen.github.io/2015/06/23/How-to-hideshow-Toolbar-when-list-is-scrolling(part3)/