Bug 1107386 - Set internal container height as height of MenuPopup. r=mhaigh, a=sledru
authorMichael Comella <michael.l.comella@gmail.com>
Fri, 23 Jan 2015 12:30:56 -0800
changeset 249398 166eac7ff25c04e8f10b6eac953cb89756ecf3a7
parent 249397 e485039f43019b613cf0970886ab2367feab4c12
child 249399 3ba70e3d1e0dd20a9ed88ebd4658d0ebf8d64bf6
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmhaigh, sledru
bugs1107386, 7698709
milestone37.0a2
Bug 1107386 - Set internal container height as height of MenuPopup. r=mhaigh, a=sledru Solution via http://stackoverflow.com/a/7698709
mobile/android/base/menu/MenuPopup.java
--- a/mobile/android/base/menu/MenuPopup.java
+++ b/mobile/android/base/menu/MenuPopup.java
@@ -61,16 +61,18 @@ public class MenuPopup extends PopupWind
     }
 
     /**
      * A small little offset.
      */
     @Override
     public void showAsDropDown(View anchor) {
         // Set a height, so that the popup will not be displayed below the bottom of the screen.
-        setHeight(mPopupMinHeight);
+        // We use the exact height of the internal content, which is the technique described in
+        // http://stackoverflow.com/a/7698709
+        setHeight(mPanel.getHeight());
 
         // Attempt to align the center of the popup with the center of the anchor. If the anchor is
         // near the edge of the screen, the popup will just align with the edge of the screen.
         final int xOffset = anchor.getWidth()/2 - mPopupWidth/2;
         showAsDropDown(anchor, xOffset, -mYOffset);
     }
 }