diff options
| author | Adam Powell <adamp@google.com> | 2010-03-15 18:27:38 -0700 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-03-15 18:27:38 -0700 |
| commit | 650e22ca3a97501e12f4befb80f2cd5b39ea78bc (patch) | |
| tree | 3b0745d1e056080fb82ab723613fd51ee1257bbe | |
| parent | 82ce6f1c8efd78f988a9a9c8e1017707fe2a6470 (diff) | |
| parent | 22cb2f46fdbb9a904ac394f488278fb47e2d4734 (diff) | |
| download | frameworks_base-650e22ca3a97501e12f4befb80f2cd5b39ea78bc.zip frameworks_base-650e22ca3a97501e12f4befb80f2cd5b39ea78bc.tar.gz frameworks_base-650e22ca3a97501e12f4befb80f2cd5b39ea78bc.tar.bz2 | |
Merge "Fix monkey bug 2512055"
| -rw-r--r-- | core/java/com/android/internal/view/menu/IconMenuView.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/core/java/com/android/internal/view/menu/IconMenuView.java b/core/java/com/android/internal/view/menu/IconMenuView.java index bba2ee2..beb57ba 100644 --- a/core/java/com/android/internal/view/menu/IconMenuView.java +++ b/core/java/com/android/internal/view/menu/IconMenuView.java @@ -179,6 +179,10 @@ public final class IconMenuView extends ViewGroup implements ItemInvoker, MenuVi */ private void layoutItems(int width) { int numItems = getChildCount(); + if (numItems == 0) { + mLayoutNumRows = 0; + return; + } // Start with the least possible number of rows int curNumRows = @@ -470,15 +474,18 @@ public final class IconMenuView extends ViewGroup implements ItemInvoker, MenuVi // Get the desired height of the icon menu view (last row of items does // not have a divider below) + final int layoutNumRows = mLayoutNumRows; final int desiredHeight = (mRowHeight + mHorizontalDividerHeight) * - mLayoutNumRows - mHorizontalDividerHeight; + layoutNumRows - mHorizontalDividerHeight; // Maximum possible width and desired height setMeasuredDimension(measuredWidth, resolveSize(desiredHeight, heightMeasureSpec)); // Position the children - positionChildren(mMeasuredWidth, mMeasuredHeight); + if (layoutNumRows > 0) { + positionChildren(mMeasuredWidth, mMeasuredHeight); + } } |
