我有一點困難,同時試圖讓一定的佈局工作:我想有名單。列表不必滾動,但應完全顯示。但是,如果總頁面內容高於屏幕,頁面本身應該能夠滾動(使用列表)。android listview顯示所有可用的項目沒有滾動與靜態標題
<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行),而不是填充可用的高度,以及清單自身可以滾動。我怎樣才能改變佈局總是顯示整個列表,但讓屏幕滾動?
http://www.anddev.org/viewtopic.php?p=25194 在另外一個論壇上,我發現了一些評論的東西像這樣 「,因爲一個ListView已經有滾動的能力。因此,我已經重寫我的自定義列表繼承自LinearLayout,它在ScrollView中工作正常,我不知道這是否是唯一的方法,但它實現了我現在想要做的事情。「 你能幫我解決以上情況嗎? – 2009-11-22 19:26:41
..請你給我們提供一些代碼和xml佈局,你可以在其中實現整個屏幕滾動...謝謝... – 2011-06-22 17:26:30