我试图实现一个布局,但遇到了一些困难:我想要一个列表。这个列表不需要滚动,但应该完全显示出来。但是如果总内容高度比屏幕高,整个页面应该可以滚动(包括列表)。
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linear_layout"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#ff181818"
>
<Textview android:id="@+id/my_text" text="header contents goes here" android:layout_width="fill_parent" android:layout_height="wrap_content"/>
<Textview android:id="@+id/headertext" text="header contents goes here" android:layout_width="fill_parent" android:layout_height="wrap_content"/>
<ListView
android:id="@+id/my_list1"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
/>
</LinearLayout>
</ScrollView>
它只使用屏幕的一小部分(每个列表大约2行),而不是填充可用高度,列表本身可以滚动。我该如何更改布局以始终显示整个列表但使屏幕可滚动?