所以,最近我一直在試圖爲我的應用做一個佈局。我基本上需要一個TextView,一個ImageView,一個ListView和一個多行TextView。所以,ListView的所有內容都是完全可見的。在屏幕的底部有ListView,有1.5個元素可見,並且列表本身可以滾動。但是,在它下面沒有那個TextView的蹤跡,並且只有ListView的一小部分可見的事實令人討厭。但是,我的ListView應該包含最多6-8個元素,那麼是否有任何簡單的技巧將ScrollView作爲所有這些的父項,並使其下方的ListView和TextView完全可見?就像修改ListView的大小一樣,所以它不必滾動並導致進入ScrollView時出現這個問題,我已經讀了大約一千次?提前致謝!希望有人會幫助因爲我迫切需要這個。我是Android開發人員的初學者,但迄今爲止表現很好。再次感謝。ListView prob - Android
編輯:所以,這裏是我做過什麼:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/tvTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:text="Large Text"
android:textSize="25sp" />
<ImageView
android:id="@+id/ivPicture"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="18dp"
android:src="@drawable/android" />
<ListView
android:id="@+id/lvElements"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="23dp" >
</ListView>
<TextView
android:id="@+id/tvDesc"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp" >
</TextView>
</LinearLayout>
</ScrollView>
但儘管如此,ListView控件現在還不是滾動的,它表明只有第一個元素。但是,我可以看到最後一個TextView。現在怎麼辦?
我不知道O_O我刪除我的答案,以便其他人將試圖爲您解決這個例子。 – Piovezan
從不在ListView中放入ListView,請參閱http://stackoverflow.com/questions/3495890/how-can-i-put-a-listview-into-a-scrollview-without-it-collapsing – 2Dee