Merge "Avoid repositioning unattached overlay views" into jb-mr2-dev
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user