min height fill_parent and height wrap_content in ScrollView? (or just the email app compose layout's code)

I ran across a link to the mail app source code in my accepted answer on another question. The answer is simple! Add android:fillViewport="true" to the <ScrollView...> and add android:layout_weight="1.0" to the view you want to take up all the available space. explained in this blogspot


As mentioned above the right way is to use the android:fillViewport="true" attribute.

There is an example, where the image will be positioned at the and of scrollView:

  <ScrollView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:fillViewport="true">
    <LinearLayout
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:fillViewport="true"
      android:orientation="vertical">

      <LinearLayout
        android:layout_height="fill_parent"
        android:layout_width="wrap_content"
        android:orientation="vertical"
        android:layout_weight="1">
        <TextView
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:text="test"/>
      </LinearLayout>


      <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:background="@color/red">
        <ImageView
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:adjustViewBounds="true"
          android:src="@drawable/about_us_image_1_land"
          style="@style/layout_marginTop20"/>
      </LinearLayout>
    </LinearLayout>
   </ScrollView>