title: Undesired FrameLayout Stretch to Wrap All Children's Heights (Instead of Respecting Just One Child's Height)
body: <p>Basically, I am using a popular tactic to center a background image for a <code>LinearLayout</code> by wrapping it in a <code>FrameLayout</code> and adding an ImageView that uses <code>fill_parent</code> before the <code>LinearLayout</code>. However, when I add a <code>ScrollView</code> in the game, everything changes.</p>
  
  <p>The issues is that the image is quite large vertically and the <code>ScrollView</code> respects the height of both the <code>ImageView</code> and the <code>LinearLayout</code> due to the <code>wrap_content</code> height attribute. This causes an undesired blank space below the LinearLayout when the image is vertically larger than it.</p>
  
  <p>How do I make the <code>FrameLayout</code>'s height stretch only to the child LinearLayout's height? If possible, without mangling with its sizes programmatically on run-time/draw-time.</p>
  
  <pre><code>&lt;ScrollView
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:fillViewport="true" &gt;
  
      &lt;FrameLayout
          android:layout_width="fill_parent"
          android:layout_height="wrap_content" &gt;
  
          &lt;ImageView
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:scaleType="center"
              android:src="@drawable/cash_bg" /&gt;
  
          &lt;LinearLayout
              android:id="@+id/main_ll"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:gravity="center"
              android:orientation="vertical" &gt;
  
              &lt;!-- My main views are here --&gt;
  
          &lt;/LinearLayout&gt;
      &lt;/FrameLayout&gt;
  &lt;/ScrollView&gt;
  </code></pre>