From dea890fa64bca15637e824306aa301775e933eee Mon Sep 17 00:00:00 2001 From: Philip Milne Date: Sat, 24 May 2014 21:02:45 -0700 Subject: [PATCH] More on weights in GridLayout Chance as little as possible from existing. If weights are defined only a subset of the views in a layout (the normal case) leave the layout of the remaining views unaffected. Change-Id: I27473e303c0666930e2fb515b794df96a8b97272 --- core/java/android/widget/GridLayout.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/java/android/widget/GridLayout.java b/core/java/android/widget/GridLayout.java index df27f86a50967..defc26ccabec5 100644 --- a/core/java/android/widget/GridLayout.java +++ b/core/java/android/widget/GridLayout.java @@ -1322,7 +1322,7 @@ public class GridLayout extends ViewGroup { // we must include views that are GONE here, see introductory javadoc LayoutParams lp = getLayoutParams(c); Spec spec = horizontal ? lp.columnSpec : lp.rowSpec; - int size = !hasWeights() ? + int size = (spec.weight == 0) ? getMeasurementIncludingMargin(c, horizontal) : getOriginalMeasurements()[i] + getDeltas()[i]; groupBounds.getValue(i).include(GridLayout.this, c, spec, this, size);