diff options
author | Chet Haase <chet@google.com> | 2013-04-16 17:58:36 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-04-16 17:58:37 +0000 |
commit | b2488931cbd25c0e9dbc648882e272048c075741 (patch) | |
tree | 41d7288ebd48746c3d7efdc3fe1e78bb612931ca /core/java/android | |
parent | 5584737fff6350ab09fb53e6a73bbff770930727 (diff) | |
parent | face742d31a7a72a4bdced5594e00e51ecee6c84 (diff) | |
download | frameworks_base-b2488931cbd25c0e9dbc648882e272048c075741.zip frameworks_base-b2488931cbd25c0e9dbc648882e272048c075741.tar.gz frameworks_base-b2488931cbd25c0e9dbc648882e272048c075741.tar.bz2 |
Merge "Avoid repositioning unattached overlay views" into jb-mr2-dev
Diffstat (limited to 'core/java/android')
-rw-r--r-- | core/java/android/view/ViewGroupOverlay.java | 3 | ||||
-rw-r--r-- | core/java/android/view/ViewOverlay.java | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/core/java/android/view/ViewGroupOverlay.java b/core/java/android/view/ViewGroupOverlay.java index c1b24f2..16afc5d 100644 --- a/core/java/android/view/ViewGroupOverlay.java +++ b/core/java/android/view/ViewGroupOverlay.java @@ -47,7 +47,8 @@ public class ViewGroupOverlay extends ViewOverlay { * animation effect.</p> * * <p>If the view has a parent, the view will be removed from that parent - * before being added to the overlay. Also, the view will be repositioned + * before being added to the overlay. Also, if that parent is attached + * in the current view hierarchy, the view will be repositioned * such that it is in the same relative location inside the activity. For * example, if the view's current parent lies 100 pixels to the right * and 200 pixels down from the origin of the overlay's diff --git a/core/java/android/view/ViewOverlay.java b/core/java/android/view/ViewOverlay.java index 78e2597..fe5b990 100644 --- a/core/java/android/view/ViewOverlay.java +++ b/core/java/android/view/ViewOverlay.java @@ -157,7 +157,8 @@ public class ViewOverlay { public void add(View child) { if (child.getParent() instanceof ViewGroup) { ViewGroup parent = (ViewGroup) child.getParent(); - if (parent != mHostView) { + if (parent != mHostView && parent.getParent() != null && + parent.mAttachInfo != null) { // Moving to different container; figure out how to position child such that // it is in the same location on the screen int[] parentLocation = new int[2]; |