我有一個佈局,在一行頂部有3個按鈕,然後是一個ListView,後面跟着一個ListView下面的按鈕。 這是我layout.xml文件丟失的按鈕放在ListView之後
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button android:id="@+id/btn_top10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TOP 10"/>
<Button android:id="@+id/btn_top100"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TOP 100"
android:layout_toRightOf="@id/btn_top10"/>
<Button android:id="@+id/btn_showAll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Show All"
android:layout_toRightOf="@id/btn_top100"/>
<ListView android:id="@+id/LV_Device"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/btn_top10"
android:layout_above="@id/LV_Device"/>
<Button android:id="@+id/btn_clearResult"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Clear Results"
android:layout_below="@id/LV_Device"/>
</RelativeLayout>
這將在下面給出這樣
結果。如果我一定值添加到ListView那麼它的確定,按鈕將展示
但是,如果列表視圖變得比屏幕尺寸更大然後在下面的按鈕,甚至不會滾動到ListView
如何解決這個問題的底部,之後是可見的?我不想讓按鈕固定在屏幕的底部。我希望該按鈕僅顯示在ListView的末尾
Thanks..this works ..但正如我已經說過,我不想要按鈕被固定在屏幕的底部。我希望在ListView的末尾看到按鈕。怎麼做? – Shijilal 2011-02-14 03:39:01
然後,您應該切換到LinearLayout並使用權重。但是你應該知道ListView並不真正支持「wrap_content」高度。當您將其設置爲wrap_content時,它總是假設3行的高度。 ListView的要點是能夠有效地滾動數以萬計(或更多)的項目。 – 2011-02-14 06:34:41
hmm.ohk。因爲我無法找到我正在尋找的完美答案..我認爲你的建議接近完美..謝謝。但我真的不認爲線性佈局將能夠解決我的問題。 – Shijilal 2011-02-14 16:38:37