问题 如果我有以下内容:
<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>
我该如何让正文(第二个EditText)填满剩余的屏幕,但当正文内容太长时仍然启用ScrollView?就像 height="wrap_content"
和 minHeight="fill_parent"
一样。
如果将它们放在ScrollView中,layout_height="fill_parent"
似乎不起作用。
符合我要求的一个工作示例是电子邮件应用程序的撰写窗口
我尝试过这个方法,但EditText元素表现得像是wrap_content,没有填充发生。只有在键入足够多的内容时才会滚动。
<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>