Merge change 8825 into donut

* changes:
  Fixes 2017393. Correctly apply gravity in RelativeLayout.
This commit is contained in:
Android (Google) Code Review
2009-07-28 11:19:19 -07:00
3 changed files with 9 additions and 5 deletions

View File

@@ -432,7 +432,7 @@ public class RelativeLayout extends ViewGroup {
width = resolveSize(width, widthMeasureSpec);
if (offsetHorizontalAxis) {
for (int i = 0; i < count; i++) {
for (int i = 0; i < count; i++) {
View child = getChildAt(i);
if (child.getVisibility() != GONE) {
LayoutParams params = (LayoutParams) child.getLayoutParams();
@@ -486,10 +486,14 @@ public class RelativeLayout extends ViewGroup {
View child = getChildAt(i);
if (child.getVisibility() != GONE && child != ignore) {
LayoutParams params = (LayoutParams) child.getLayoutParams();
params.mLeft += horizontalOffset;
params.mRight += horizontalOffset;
params.mTop += verticalOffset;
params.mBottom += verticalOffset;
if (horizontalGravity) {
params.mLeft += horizontalOffset;
params.mRight += horizontalOffset;
}
if (verticalGravity) {
params.mTop += verticalOffset;
params.mBottom += verticalOffset;
}
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB