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

Viewed 22179

Question If I have the following:

<ScrollView android:layout_width="fill_parent" android:layout_height="fill_parent">
    <LinearLayout android:layout_width="fill_parent" android:layout_height="?" android:orientation="vertical">
        <EditText android:layout_width="fill_parent" android:layout_height="?" android:hint="Subject" android:id="@+id/subject" />
        <EditText android:layout_width="fill_parent" android:layout_height="?" android:id="@+id/body" />
    </LinearLayout>
</ScrollView>

How can I get the body (second EditText) to fill the rest of the screen, but still have the scrollview kick in when the contents of the body are too long? Like a height="wrap_content" and minHeight="fill_parent"

layout_height="fill_parent" seems to not do anything if you put them in a scrollview

A working example of what I want is the email app compose window

I tried this and the EditText elements act like they are wrap_content and no filling is happening. Just scrolling if you type enough

<ScrollView android:layout_width="fill_parent" android:layout_height="fill_parent">
    <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical">
        <EditText android:layout_width="fill_parent" android:layout_height="fill_parent" layout_weight="1" android:hint="Subject" android:id="@+id/subject" />
        <EditText android:layout_width="fill_parent" android:layout_height="fill_parent" layout_weight="1" android:id="@+id/body" />
    </LinearLayout>
</ScrollView>
4 Answers
Related