对话主题活动包裹scrollview更好

时间:2013-01-09 18:09:34

标签: android android-layout dialog scrollview

我有一个以Holo.Dialog为主题的活动(或旧API级别的普通旧Dialog),并包含一个ScrollView作为它的主要布局,以防我们遇到无法显示所有的小屏幕内容。我现在的问题是对话框需要滚动查看所有内容,即使我们有剩余的垂直屏幕空间,如下所示:

enter image description here

这是ScrollView的代码,它是一个孩子,一个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" >

我需要更改什么才能使此对话框更好地包装?谢谢!

1 个答案:

答案 0 :(得分:0)

对我有用的解决方案是从ScrollView中取出按钮并将它们放在RelativeLayout中的顶层。通过将按钮栏放在XML中,与父底部对齐,然后将scrollView的layout_above设置为buttonBar,我得到了我正在寻找的效果