在我的一個活動中,我展示了某些信息,最後我有一個ListView
。 所以我的佈局看起來有點像:在包含ListView的視圖中滾動(Android)
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="30dip"
>
...
<ListView android:id="@android:id/android:list" android:layout_width="wrap_content"
android:layout_height="fill_parent" />
</LinearLayout>
當我運行仿真器中我看到列表視圖前的信息在屏幕上始終顯示並沒有只爲ListView
垂直滾動的應用程序。
有沒有辦法改變這種滾動行爲?我想要的是一個垂直滾動屏幕上的所有信息,不僅在ListView
的水平。
我嘗試用ScrollView
包裝LinearLayout
,對於所涉及的所有視圖使用不同的android:layout_height
屬性組合,但沒有得到我期待的效果。此外,有人說,這是一個非常糟糕的主意來包裝一個ListView
與ScrollView
:
Android ScrollView layout problem
Scrolling with Multiple ListViews for Android
感謝您的任何其他想法。
您可能想重新考慮佈局的設置方式。例如,您可以將任何它在ListView上方的列表視圖添加到列表視圖中作爲第一個(和第二個等)項目 – ghostbust555