Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- View anchorView = getActivity().findViewById("R.id.myView")
- if (ViewCompat.isLaidOut(anchorView)) {
- anchorView.getLocationInWindow(location);
- Log.w(
- "*****",
- "====alignWithAnchorView:: anchor width="
- + anchorView.getWidth()
- + " anchor x="
- + location[0]
- + " anchor y="
- + location[1]);
- alignWithAnchorView(anchorView);
- } else {
- anchorView
- .getViewTreeObserver()
- .addOnGlobalLayoutListener(
- new OnGlobalLayoutListener() {
- @Override
- public void onGlobalLayout() {
- anchorView.getLocationInWindow(location);
- Log.w(
- "*****",
- "====onGlobalLayout:: anchor width="
- + anchorView.getWidth()
- + " anchor x="
- + location[0]
- + " anchor y="
- + location[1]);
- alignWithAnchorView(anchorView);
- OneGoogleViewCompat.removeOnGlobalLayoutListener(anchorView, this);
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement