Guest User

Untitled

a guest
Nov 15th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. // packRecyclerView.getViewTreeObserver().addOnGlobalLayoutListener(); replace this line with the next one
  2. packRecyclerView.getViewTreeObserver().addOnGlobalLayoutListener(onGlobalLayoutListener);
  3.  
  4. private ViewTreeObserver.OnGlobalLayoutListener onGlobalLayoutListener = new ViewTreeObserver
  5. .OnGlobalLayoutListener() {
  6. @Override
  7. public void onGlobalLayout() {
  8. // do something here
  9. //...
  10. // after that remove the listener
  11. globalLayout.getViewTreeObserver().removeOnGlobalLayoutListener(onGlobalLayoutListener);
  12. }
  13. };
Add Comment
Please, Sign In to add comment