OSDN Git Service

Ensure that popup width and height are correct on update
authorAlan Viverette <alanv@google.com>
Tue, 22 Mar 2016 15:23:05 +0000 (11:23 -0400)
committerAlan Viverette <alanv@google.com>
Tue, 22 Mar 2016 15:23:05 +0000 (11:23 -0400)
Bug: 26696843
Change-Id: I8b0409aeca02b4ad551689bdf003d95f5435e567

core/java/android/widget/PopupWindow.java

index a1417f0..d1b5fc8 100644 (file)
@@ -2027,21 +2027,24 @@ public class PopupWindow {
             mAnchorYoff = yoff;
         }
 
+        final WindowManager.LayoutParams p =
+                (WindowManager.LayoutParams) mDecorView.getLayoutParams();
+
         if (updateDimension) {
             if (width == -1) {
                 width = mPopupWidth;
             } else {
                 mPopupWidth = width;
+                p.width = width;
             }
             if (height == -1) {
                 height = mPopupHeight;
             } else {
                 mPopupHeight = height;
+                p.height  = height;
             }
         }
 
-        final WindowManager.LayoutParams p =
-                (WindowManager.LayoutParams) mDecorView.getLayoutParams();
         final int x = p.x;
         final int y = p.y;
         if (updateLocation) {