Skip to content

Instantly share code, notes, and snippets.

@mzgreen
Last active August 29, 2015 14:15
Show Gist options
  • Save mzgreen/dcc0b173f22fcec971ea to your computer and use it in GitHub Desktop.
Save mzgreen/dcc0b173f22fcec971ea to your computer and use it in GitHub Desktop.
HideOnScrollExample - MainActivity hide/show methods
private void hideViews() {
mToolbar.animate().translationY(-mToolbar.getHeight()).setInterpolator(new AccelerateInterpolator(2));
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mFabButton.getLayoutParams();
int fabBottomMargin = lp.bottomMargin;
mFabButton.animate().translationY(mFabButton.getHeight()+fabBottomMargin).setInterpolator(new AccelerateInterpolator(2)).start();
}
private void showViews() {
mToolbar.animate().translationY(0).setInterpolator(new DecelerateInterpolator(2));
mFabButton.animate().translationY(0).setInterpolator(new DecelerateInterpolator(2)).start();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment