Skip to content

Instantly share code, notes, and snippets.

@dolphinziyo
Last active October 27, 2016 18:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dolphinziyo/b562b3ce8db1ad30dbc9 to your computer and use it in GitHub Desktop.
Save dolphinziyo/b562b3ce8db1ad30dbc9 to your computer and use it in GitHub Desktop.
Moves a custom "close drawer button" and changes its alpha according to the Navigation Drawer opening offset
/**
* Moves a custom "close drawer button" and changes its alpha according to the Navigation Drawer opening offset
* @param offset Drawer opening offset
*/
private void animateDrawerCloseButton(float offset) {
imbtnCloseDrawerButton.setX(recyclerView.getX() + recyclerView.getWidth() + convertDpiToPixels(15)); // (15) Distance between the button and the Drawer
offset *= 255; // (255) Max alpha
imbtnCloseDrawerButton.getDrawable().setAlpha((int) offset);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment