summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Milne <pmilne@google.com>2011-06-20 10:28:18 -0700
committerPhilip Milne <pmilne@google.com>2011-06-20 10:59:16 -0700
commit09e2d4d0d5101e2fc44909b83965465a7b90afab (patch)
tree562a9dc19669433f248c2de0a265f41a128a9ca1
parentdf02afe8355e1e7a6f8f02549f41a166c3ee6932 (diff)
downloadframeworks_base-09e2d4d0d5101e2fc44909b83965465a7b90afab.zip
frameworks_base-09e2d4d0d5101e2fc44909b83965465a7b90afab.tar.gz
frameworks_base-09e2d4d0d5101e2fc44909b83965465a7b90afab.tar.bz2
Ensure measuredWidth > getSuggestedMinimumWidth(), same for height.
Change-Id: I7f2dc2e874d8aacf961e98fe41139ada7a992449
-rw-r--r--core/java/android/widget/GridLayout.java23
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
*/