Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/211.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 在ExpandableListView之后向视图添加线性布局,而在填充时不被ExpandableListView覆盖?_Android - Fatal编程技术网

Android 在ExpandableListView之后向视图添加线性布局,而在填充时不被ExpandableListView覆盖?

Android 在ExpandableListView之后向视图添加线性布局,而在填充时不被ExpandableListView覆盖?,android,Android,当我填充列表视图时,ExpandableListView下面的线性布局将消失。我希望“@+id/bottomActionBarAppoints”布局始终在屏幕上可见。我不想为ExpandableListView设置静态高度。 提前感谢您的帮助。以下是我的布局xml: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.

当我填充列表视图时,ExpandableListView下面的线性布局将消失。我希望“@+id/bottomActionBarAppoints”布局始终在屏幕上可见。我不想为ExpandableListView设置静态高度。 提前感谢您的帮助。
以下是我的布局xml:

<LinearLayout 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"
    android:orientation="vertical"
    tools:context=".AppointmentsActivity" >

    <LinearLayout
        android:id="@+id/calendar1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >
    </LinearLayout>

    <ExpandableListView
        android:id="@+id/expandableListViewAppointments"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:groupIndicator="@null" >
    </ExpandableListView>

    <LinearLayout
        android:id="@+id/bottomActionBarAppointments"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >
    </LinearLayout>
</LinearLayout>

在尝试了一些更改后找到了答案。 我使用layout_-weight属性允许每个线性布局共享屏幕的特定部分。 以下是我的布局XML:

<LinearLayout 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"
    android:orientation="vertical"
    tools:context=".AppointmentsActivity" >

    <LinearLayout
        android:id="@+id/calendar1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:background="@color/green"
        android:layout_weight="0.1" >
    </LinearLayout>

    <LinearLayout
        android:id="@+id/listViewLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"

        android:layout_weight="0.8">

        <ExpandableListView
            android:id="@+id/expandableListViewAppointments"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:groupIndicator="@null" >
        </ExpandableListView>
    </LinearLayout>

    <LinearLayout
        android:id="@+id/bottomActionBarAppointments"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:background="@color/green" 
        android:layout_weight="0.1">
    </LinearLayout>

</LinearLayout>