Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cocoa/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android layout android中是否有这样的布局选项占用父容器中的剩余空间?_Android Layout - Fatal编程技术网

Android layout android中是否有这样的布局选项占用父容器中的剩余空间?

Android layout android中是否有这样的布局选项占用父容器中的剩余空间?,android-layout,Android Layout,我想在android上做这样的布局,我想不出来 一个按钮在顶部,一个按钮在底部,一个listview占据休息中心区域,如何使listview占据休息区域?如果父容器是垂直线性布局,这是否可能 谢谢我在项目中所做的是 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_

我想在android上做这样的布局,我想不出来

一个按钮在顶部,一个按钮在底部,一个listview占据休息中心区域,如何使listview占据休息区域?如果父容器是垂直线性布局,这是否可能


谢谢

我在项目中所做的是

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <Button
        android:id="@+id/task_title"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:text="@string/tasks" />

    <ListView
        android:id="@id/android:list"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/task_title" 
        android:layout_above="@+id/add_button">
        <!-- Preview: listitem=@layout/task_list_item -->
    </ListView>

    <TextView
        android:id="@id/android:empty"
        android:text="@string/no_tasks"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="center_vertical|center_horizontal"
        android:layout_below="@id/task_title" 
        android:layout_above="@id/add_button"/>


    <Button
        android:id="@id/add_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:text="@string/plus_sign" />

    <Button
        android:id="@+id/remove_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_toRightOf="@id/add_button"
        android:text="@string/remove_task" />

</RelativeLayout>


使用相对布局,您只需简单地进行操作,关键布局属性是
android:layout\u alignParentBottom=“true”
android:layout\u alignParentTop=“true”

无论如何,没有人会喜欢这样的问题。