Issue
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>
Solution
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
Answered By - 700 Software
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.