Android 在ExpandableListView之后向视图添加线性布局,而在填充时不被ExpandableListView覆盖?
当我填充列表视图时,ExpandableListView下面的线性布局将消失。我希望“@+id/bottomActionBarAppoints”布局始终在屏幕上可见。我不想为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.
以下是我的布局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>