Avoid repositioning unattached overlay views
Adding a view to an overlay usually entails removing the view from its current parent, if it has one. ViewOverlay.add() will do this automatically. At the same time, it will check to see whether the parent view is in a different global location than the overlay's host view, and will adjust the added view accordingly. This enables the caller to simply toss a view into an overlay and have it end up at the same global position on the screen. the problem is that the current code doesn't bother to check whether the old parent is attached. If that parent has been removed from the view hierarchy before this overlay operation, then it will show up as being at (0,0) in the window, not its old location. This results in the view being mis-positioned in the overaly. Fix is simple: if the view's old parent is not attached, simply remove it from that parent before adding it to the overlay; don't try to compensate for its position which is based on wrong information. Issue #8620319 Overlay should only use relative window locations for onscreen parents Change-Id: I414038a6c355dfd58f9766b007ac44d535ef1889
Loading
Please register or sign in to comment