diff options
author | Philip Milne <pmilne@google.com> | 2011-06-20 11:12:38 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-06-20 11:12:38 -0700 |
commit | d63205230aafa8a5555cb00e0771f70b14f90aef (patch) | |
tree | 7464e9cc8b765e1bb29b129eabdb9302779b35fc | |
parent | 15a16a835ef07d484e0ae11666cef9231c2f8184 (diff) | |
parent | 09e2d4d0d5101e2fc44909b83965465a7b90afab (diff) | |
download | frameworks_base-d63205230aafa8a5555cb00e0771f70b14f90aef.zip frameworks_base-d63205230aafa8a5555cb00e0771f70b14f90aef.tar.gz frameworks_base-d63205230aafa8a5555cb00e0771f70b14f90aef.tar.bz2 |
Merge "Ensure measuredWidth > getSuggestedMinimumWidth(), same for height."
-rw-r--r-- | core/java/android/widget/GridLayout.java | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/core/java/android/widget/GridLayout.java b/core/java/android/widget/GridLayout.java index 4a514bf..46e4398 100644 --- a/core/java/android/widget/GridLayout.java +++ b/core/java/android/widget/GridLayout.java @@ -765,9 +765,12 @@ public class GridLayout extends ViewGroup { int computedWidth = getPaddingLeft() + mHorizontalAxis.getMin() + getPaddingRight(); int computedHeight = getPaddingTop() + mVerticalAxis.getMin() + getPaddingBottom(); + int measuredWidth = Math.max(computedWidth, getSuggestedMinimumWidth()); + int measuredHeight = Math.max(computedHeight, getSuggestedMinimumHeight()); + setMeasuredDimension( - resolveSizeAndState(computedWidth, widthSpec, 0), - resolveSizeAndState(computedHeight, heightSpec, 0)); + resolveSizeAndState(measuredWidth, widthSpec, 0), + resolveSizeAndState(measuredHeight, heightSpec, 0)); } private int protect(int alignment) { @@ -809,9 +812,9 @@ public class GridLayout extends ViewGroup { and sizing to each child view and then placing it in its cell. */ @Override - protected void onLayout(boolean changed, int l, int t, int r, int b) { - int targetWidth = r - l; - int targetHeight = b - t; + protected void onLayout(boolean changed, int left, int top, int right, int bottom) { + int targetWidth = right - left; + int targetHeight = bottom - top; int paddingLeft = getPaddingLeft(); int paddingTop = getPaddingTop(); @@ -2172,9 +2175,8 @@ public class GridLayout extends ViewGroup { * * @param view the view to which this alignment should be applied * @param viewSize the measured size of the view - * @param measurementType The type of measurement that should be made. This feature - * is currently unused as GridLayout only supports one - * type of measurement: {@link View#measure(int, int)}. + * @param measurementType This parameter is currently unused as GridLayout only supports + * one type of measurement: {@link View#measure(int, int)}. * * @return the alignment value */ @@ -2190,9 +2192,8 @@ public class GridLayout extends ViewGroup { * @param view the view to which this alignment should be applied * @param viewSize the measured size of the view * @param cellSize the size of the cell into which this view will be placed - * @param measurementType The type of measurement that should be made. This feature - * is currently unused as GridLayout only supports one - * type of measurement: {@link View#measure(int, int)}. + * @param measurementType This parameter is currently unused as GridLayout only supports + * one type of measurement: {@link View#measure(int, int)}. * * @return the aligned size */ |