Fix for bug: 8184401 - GridLayout accounts for child's size/measurements even when a child is "GONE"

Added a check for GONE status in measurement calculations.

Change-Id: I3ec82b03f3089730f10dbd6916f6245188cd8452
This commit is contained in:
Philip Milne
2013-02-12 14:29:17 -08:00
parent 145716e7c1
commit e5e0b7f191

View File

@@ -1235,6 +1235,7 @@ public class GridLayout extends ViewGroup {
Assoc<Spec, Bounds> assoc = Assoc.of(Spec.class, Bounds.class);
for (int i = 0, N = getChildCount(); i < N; i++) {
View c = getChildAt(i);
if (c.getVisibility() == View.GONE) continue;
LayoutParams lp = getLayoutParams(c);
Spec spec = horizontal ? lp.columnSpec : lp.rowSpec;
Bounds bounds = getAlignment(spec.alignment, horizontal).getBounds();
@@ -1250,6 +1251,7 @@ public class GridLayout extends ViewGroup {
}
for (int i = 0, N = getChildCount(); i < N; i++) {
View c = getChildAt(i);
if (c.getVisibility() == View.GONE) continue;
LayoutParams lp = getLayoutParams(c);
Spec spec = horizontal ? lp.columnSpec : lp.rowSpec;
groupBounds.getValue(i).include(GridLayout.this, c, spec, this);