Android 在与父对象对齐时填充可用空间
LinearLayout粘贴到RelativeLayout的底部,但具有固定的高度(其子项的包裹内容-按钮) 我希望LinearLayout有尽可能多的可用空间(因为ListView可以有0或1000个元素),但也要确保当ListView有很多元素时按钮仍然可见Android 在与父对象对齐时填充可用空间,android,android-relativelayout,Android,Android Relativelayout,LinearLayout粘贴到RelativeLayout的底部,但具有固定的高度(其子项的包裹内容-按钮) 我希望LinearLayout有尽可能多的可用空间(因为ListView可以有0或1000个元素),但也要确保当ListView有很多元素时按钮仍然可见 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ListView
android:id="@+id/listView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/linear"
android:layout_alignParentTop="true">
</ListView>
<LinearLayout
android:id="@+id/linear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical" >
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" >
</Button>
</LinearLayout>
尝试以下方法,看看是否有效:
希望有帮助。再多解释一点。你的布局有什么问题?当前的行为不好?或在此添加屏幕截图。线性布局的高度限制为按钮的高度。我希望这个线性布局有尽可能多的高度,而不仅仅是按钮所需的数量。那么listview的高度呢?