summaryrefslogtreecommitdiffstats
path: root/core/java/android/widget/GridLayout.java
diff options
context:
space:
mode:
authorPhilip Milne <pmilne@google.com>2011-10-25 15:07:19 -0700
committerJim Miller <jaggies@google.com>2011-10-31 16:26:55 -0700
commit6b248641fc597a490d86cb4760d455e7f530b21b (patch)
treede214c7155d2a7e3bad990888a44ce4e25b16255 /core/java/android/widget/GridLayout.java
parent2333a02e152616c4b982c149ea2a5c9e9615e274 (diff)
downloadframeworks_base-6b248641fc597a490d86cb4760d455e7f530b21b.zip
frameworks_base-6b248641fc597a490d86cb4760d455e7f530b21b.tar.gz
frameworks_base-6b248641fc597a490d86cb4760d455e7f530b21b.tar.bz2
Update to fix for bug 5393156
Tweak to the logic to take account of margins when gravity = FILL is used and there is a measurement dependency between the axes (as in mulit-line text). Cherry pick ecab1178648670f2c72b47faf250040fcded3d13 to MR1 Change-Id: Ic0c95a4618bdb32acca75219796c66c1fc467610
Diffstat (limited to 'core/java/android/widget/GridLayout.java')
-rw-r--r--core/java/android/widget/GridLayout.java14
1 files changed, 8 insertions, 6 deletions
diff --git a/core/java/android/widget/GridLayout.java b/core/java/android/widget/GridLayout.java
index fb9047b..7cf5168 100644
--- a/core/java/android/widget/GridLayout.java
+++ b/core/java/android/widget/GridLayout.java
@@ -867,16 +867,18 @@ public class GridLayout extends ViewGroup {
if (firstPass) {
measureChildWithMargins2(c, widthSpec, heightSpec, lp.width, lp.height);
} else {
- Spec spec = (orientation == HORIZONTAL) ? lp.columnSpec : lp.rowSpec;
+ boolean horizontal = (orientation == HORIZONTAL);
+ Spec spec = horizontal ? lp.columnSpec : lp.rowSpec;
if (spec.alignment == FILL) {
Interval span = spec.span;
- Axis axis = (orientation == HORIZONTAL) ? horizontalAxis : verticalAxis;
+ Axis axis = horizontal ? horizontalAxis : verticalAxis;
int[] locations = axis.getLocations();
- int size = locations[span.max] - locations[span.min];
- if (orientation == HORIZONTAL) {
- measureChildWithMargins2(c, widthSpec, heightSpec, size, lp.height);
+ int cellSize = locations[span.max] - locations[span.min];
+ int viewSize = cellSize - getTotalMargin(c, horizontal);
+ if (horizontal) {
+ measureChildWithMargins2(c, widthSpec, heightSpec, viewSize, lp.height);
} else {
- measureChildWithMargins2(c, widthSpec, heightSpec, lp.width, size);
+ measureChildWithMargins2(c, widthSpec, heightSpec, lp.width, viewSize);
}
}
}