From e5e0b7f191b64380e9231a2b755ecd3738598dec Mon Sep 17 00:00:00 2001 From: Philip Milne Date: Tue, 12 Feb 2013 14:29:17 -0800 Subject: [PATCH] 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 --- core/java/android/widget/GridLayout.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/java/android/widget/GridLayout.java b/core/java/android/widget/GridLayout.java index 85ed8dbd4927e..12cce8bdd412a 100644 --- a/core/java/android/widget/GridLayout.java +++ b/core/java/android/widget/GridLayout.java @@ -1235,6 +1235,7 @@ public class GridLayout extends ViewGroup { Assoc 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);