我與ListView
的問題是隻有ListView是可滾動的而不是整個屏幕。填充LinearLayout?
舉例來說,如果我有類似下面的佈局,只有屏幕的ListView的一部分是滾動的,而我希望整個屏幕滾動:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/toolbar"
android:paddingLeft="24dp"
android:paddingRight="24dp"
android:paddingTop="24dp"
android:paddingBottom="24dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello, World!"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Lorem ipsum."
/>
<ListView
android:id="@+id/listview"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>
是否有可能來填充LinearLayout
,像上面那樣,爲了使整個屏幕可以滾動?
在這種情況下,你可能不希望ListView。只需添加listview的內容 - 我不知道你在那裏有什麼,也許textviews或所以 - 動態到你的linearlayout應該在scrollview內。 – poss