Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. View anchorView = getActivity().findViewById("R.id.myView")
  2.  
  3. if (ViewCompat.isLaidOut(anchorView)) {
  4. anchorView.getLocationInWindow(location);
  5. Log.w(
  6. "*****",
  7. "====alignWithAnchorView:: anchor width="
  8. + anchorView.getWidth()
  9. + " anchor x="
  10. + location[0]
  11. + " anchor y="
  12. + location[1]);
  13. alignWithAnchorView(anchorView);
  14.  
  15. } else {
  16. anchorView
  17. .getViewTreeObserver()
  18. .addOnGlobalLayoutListener(
  19. new OnGlobalLayoutListener() {
  20. @Override
  21. public void onGlobalLayout() {
  22. anchorView.getLocationInWindow(location);
  23. Log.w(
  24. "*****",
  25. "====onGlobalLayout:: anchor width="
  26. + anchorView.getWidth()
  27. + " anchor x="
  28. + location[0]
  29. + " anchor y="
  30. + location[1]);
  31. alignWithAnchorView(anchorView);
  32. OneGoogleViewCompat.removeOnGlobalLayoutListener(anchorView, this);
  33. }
  34. });
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement