Reputation: 9554
I am using the appcompat toolbar as my action bar and I have a layout right below it with some more views, it is roughly the same height as the toolbar.
I am hiding both of those together when scrolling happens on the main view of the activity (which is below them) and it is working well but the hiding is too abrupt and I would like to make it happen smoothly. I have seen a lot of posts about how to do that to the toolbar but I haven't found any for hiding the toolbar and something below it, so how to I smoothly hide and show both?
Essentially what I have is this:
<android.support.v7.widget.Toolbar .../>
<RelativeLayout .../>
Thanks.
Upvotes: 2
Views: 5584
Reputation: 6973
i have found this link on github HideOnScroll you can read about this repository by the author who has given nice explanation on how to hide toolbar here is the other link Blog Link
Upvotes: 3
Reputation: 1432
I think you have to use alpha animation with translationY animation on toolbar For i.e
view.animate()
.translationY(0)
.alpha(1).setDuration(HEADER_HIDE_ANIM_DURATION)
.setInterpolator(new DecelerateInterpolator());
For more info please refer google Ioschedule app source code.
Upvotes: 1