Here’s a simple example:

<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FF0000">

<FrameLayout
android:layout_width="10000dp"
android:layout_height="10000dp" />

<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FF9900">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="XXX" />
</FrameLayout>

</FrameLayout>

(You may want to throw that whole block in a ScrollView for more obvious results)

So what you have above is pretty straightforward. You have a container with wrap_content for height. It has 2 children, one is at a fixed height of 10000dp, and the other is set to match_parent. As expected, the parent is expanded to 10000dp in height, as you can see by the red background. However, the second sibling, whose height should “match parent”, clearly does not do that – you’ll notice the orange background of that second sibling exists only as tall enough as is required to render the TextView.

There are simple ways around this – for example, you could write a LargestChildLayout pretty simply:

public class LargestChildLayout extends ViewGroup {

  private int mWidth;
  private int mHeight;

  public LargestChildLayout(Context context) {
    super(context);
  }

  public LargestChildLayout(Context context, AttributeSet attrs) {
    super(context, attrs);
  }

  public LargestChildLayout(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
  }

  @Override
  protected void onLayout(boolean changed, int l, int t, int r, int b) {
    for (int i = 0; i < getChildCount(); i++) {
      View child = getChildAt(i);
      child.layout(0, 0, mWidth, mHeight);
    }
  }

  @Override
  protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    measureChildren(widthMeasureSpec, heightMeasureSpec);
    for (int i = 0; i < getChildCount(); i++) {
      View child = getChildAt(i);
      mWidth = Math.max(mWidth, child.getMeasuredWidth());
      mHeight = Math.max(mHeight, child.getMeasuredHeight());
    }
    setMeasuredDimension(mWidth, mHeight);
  }

}

Or if you wish to use provided components, a ConstraintLayout can achieve it as well:

<android.support.constraint.ConstraintLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="#FF0000">

  <FrameLayout
      android:layout_width="10000dp"
      android:layout_height="10000dp" />

  <FrameLayout
      android:layout_width="0dp"
      android:layout_height="0dp"
      app:layout_constraintEnd_toEndOf="parent"
      app:layout_constraintStart_toStartOf="parent"
      app:layout_constraintBottom_toBottomOf="parent"
      app:layout_constraintTop_toTopOf="parent"
      android:background="#FF9900">
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="XXX" />
  </FrameLayout>

</android.support.constraint.ConstraintLayout>

I suspect a RelativeLayout might work as well, with layout_alignParentTop and layout_alignParentBottom both set to true, but haven’t tried.