2013-01-09 27 views
2

我有一個活動,它以Holo.Dialog爲主題(或者在較舊的API級別上是普通的舊對話框),並且包含一個ScrollView作爲主佈局,以防我們遇到較小的屏幕無法顯示所有內容。我現在的問題是,該對話框需要滾動到看到所有的內容,即使我們有吃剩的垂直屏幕空間,如下所示:對話框主題活動換行滾動視圖更好

enter image description here

下面是對滾動型的代碼,它是一個孩子, LinearLayout:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/scrollView1" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" > 

<LinearLayout 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:gravity="center_horizontal" 
    android:orientation="vertical" > 

我需要更改哪些對話框以更好地包裝?謝謝!

+0

您是否嘗試過使用'maxHeight'和'minHeight'屬性?(他們是這樣的)。我被告知要爲類似的事情做這件事,但從來沒有嘗試過,因爲我的模擬器速度很慢。 – jcw

回答

0

對我而言,解決方案是將按鈕從ScrollView中取出,並將它們置於RelativeLayout的頂層。通過首先將按鈕欄放在XML中,對齊父級底部,然後將scrollView的layout_above設置爲buttonBar,我得到了我期待的效果