Skip to content

Instantly share code, notes, and snippets.

@chemickypes
Last active June 27, 2017 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chemickypes/0cfa4f235b0e00df1b5e7e01cb2c56da to your computer and use it in GitHub Desktop.
Save chemickypes/0cfa4f235b0e00df1b5e7e01cb2c56da to your computer and use it in GitHub Desktop.
Code for Article on Medium 1
...
getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
try {
getViewTreeObserver().removeGlobalOnLayoutListener(this);
int w = getWidth();
addItemDecoration(new EndOffsetDecoration(w - 50));
}catch (Exception e){
e.printStackTrace();
}
}
});
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment