0

リスト ビューにデータを入力すると、ExpandableListView の下の線形レイアウトが消えます。「@+id/bottomActionBarAppointments」レイアウトを常に画面に表示したい。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>
4

1 に答える 1

0

いくつかの変更を試みた後、答えが見つかりました。各線形レイアウトが画面の特定の部分を共有できるようにするために、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>
于 2013-10-07T22:37:39.850 に答える