Fixes 2017393. Correctly apply gravity in RelativeLayout.

RL was applying a horizontal offset to its children even when the gravity was only
specified for the vertical axis (and vice-versa.)

Also fix the ExpandableListView icons.
This commit is contained in:
Romain Guy
2009-07-28 11:18:14 -07:00
parent cdb9e971d9
commit d10a576791
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