Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a2071618 authored by Android (Google) Code Review's avatar Android (Google) Code Review Committed by The Android Open Source Project
Browse files

am 6067d953: Merge change 5428 into donut

Merge commit '6067d953'

* commit '6067d953':
  Improve handling of FILL_PARENT in RelativeLayout.
parents 1f730081 6067d953
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -358,7 +358,7 @@ public class RelativeLayout extends ViewGroup {
                LayoutParams params = (LayoutParams) child.getLayoutParams();

                applyHorizontalSizeRules(params, myWidth);
                measureChildHorizontal(child, params, myWidth);
                measureChildHorizontal(child, params, myWidth, myHeight);
                if (positionChildHorizontal(child, params, myWidth, isWrapContentWidth)) {
                    offsetHorizontalAxis = true;
                }
@@ -550,13 +550,18 @@ public class RelativeLayout extends ViewGroup {
        child.measure(childWidthMeasureSpec, childHeightMeasureSpec);
    }

    private void measureChildHorizontal(View child, LayoutParams params, int myWidth) {
    private void measureChildHorizontal(View child, LayoutParams params, int myWidth, int myHeight) {
        int childWidthMeasureSpec = getChildMeasureSpec(params.mLeft,
                params.mRight, params.width,
                params.leftMargin, params.rightMargin,
                mPaddingLeft, mPaddingRight,
                myWidth);
        int childHeightMeasureSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
        int childHeightMeasureSpec;
        if (params.width == LayoutParams.FILL_PARENT) {
            childHeightMeasureSpec = MeasureSpec.makeMeasureSpec(MeasureSpec.EXACTLY, myHeight);
        } else {
            childHeightMeasureSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
        }
        child.measure(childWidthMeasureSpec, childHeightMeasureSpec);
    }