Merge "Skip ListPopupWindow position update if detached"

This commit is contained in:
Alan Viverette
2017-03-23 14:17:28 +00:00
committed by Gerrit Code Review

View File

@ -600,6 +600,10 @@ public class ListPopupWindow implements ShowableListMenu {
mPopup.setWindowLayoutType(mDropDownWindowLayoutType); mPopup.setWindowLayoutType(mDropDownWindowLayoutType);
if (mPopup.isShowing()) { if (mPopup.isShowing()) {
if (!getAnchorView().isAttachedToWindow()) {
//Don't update position if the anchor view is detached from window.
return;
}
final int widthSpec; final int widthSpec;
if (mDropDownWidth == ViewGroup.LayoutParams.MATCH_PARENT) { if (mDropDownWidth == ViewGroup.LayoutParams.MATCH_PARENT) {
// The call to PopupWindow's update method below can accept -1 for any // The call to PopupWindow's update method below can accept -1 for any