我有一個對話框,其中包含ScrollView
內部的一個列表(中的一堆TextView
)。佈局如下:Scrollview使底部視圖在對話框中消失
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ProgressBar
android:id="@+id/delete_progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone" />
<ScrollView
android:id="@+id/filename_scroll"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:id="@+id/filename_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
</LinearLayout>
</ScrollView>
<View
android:id="@+id/horisontal_separator"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="@android:color/darker_gray" />
<LinearLayout
android:id="@+id/button_container"
android:layout_width="match_parent"
android:layout_height="48dp" >
<Button
android:id="@+id/load_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/button_load"
android:gravity="center"
android:layout_weight="1" />
<View
android:layout_width="1dp"
android:layout_height="fill_parent"
android:background="@android:color/darker_gray" />
<Button
android:id="@+id/delete_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/button_delete"
android:gravity="center"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
它看起來像這樣,只有在名單上的幾個項目:
但是,當有不止可以適合在屏幕上(並有實際需要滾動) ,我的按鈕被推到屏幕下方。當所有的方式滾動至底部,它看起來像這樣:
我需要包含按鈕繼續擔任頁腳LinearLayout
,它不應該在任何地方滾動,顯然不會消失。我試過擺弄佈局高度和重量,但無濟於事。
您是否嘗試將ListView設置爲固定高度,例如200dip? – Demonick 2013-04-24 08:55:03
我沒有實際的ListView,但改變LinearLayout的高度並沒有什麼區別。如果我改變ScrollView的高度,它會再次按下按鈕。 – j0ntech 2013-04-24 08:58:03