0
在我的表单上我有一个标签,一个多行文本框和一些按钮。我希望将按钮对齐到活动底部,多行文本框填充剩余空间。填充剩余空间,但也有按钮对齐底部
我可以让按钮捕捉到底部的唯一方法是在容器上使用android:layout_alignParentBottom,这意味着主布局必须是Relative。
但是,我可以通过多行文本框填充空间的唯一方法是容器是线性布局,并使用0dp/weight = 1。
底部的包含只是一个带按钮的水平线性布局。
有没有办法做到这一点?如下所示,我尝试过使用Table Rows等。下面是它现在的样子。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/fragmentBackdropPlain"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/buttonText"
android:text="@string/subtopic_content_name"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TableRow android:id="@+id/tableRow1" android:layout_width="match_parent" android:layout_height="wrap_content"></TableRow>
<EditText
android:id="@+id/editSubTopicContent"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:hint="@string/subtopic_content_hint"
android:inputType="textMultiLine" >
<requestFocus />
</EditText>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical" >
<include layout="@layout/include_edit_buttons" />
</LinearLayout>
</RelativeLayout>
辉煌,谢谢。如何声明上面的按钮使其工作?我只是假定按照我想要的顺序放置它们,并告诉项目在上/下/相对于另一个不会影响XML中的顺序。 –
@尼尔我在答案中添加了一个解释! – MalaKa
啊,欢呼声,我从来没有想到这一点。现在我知道,当我得到布局的其他问题时,它应该更有意义:) –