【问题标题】:Dialog themed activity wrap scrollview better以对话框为主题的活动更好地包装滚动视图
【发布时间】:2013-01-09 18:09:33
【问题描述】:

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

这是 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" >

我需要进行哪些更改才能使此对话框包装得更好?谢谢!

【问题讨论】:

  • 您是否尝试过使用maxHeightminHeight 属性?(它们是这样的)。我被告知要为类似的东西这样做,但由于我的模拟器非常慢,所以一直没有尝试过。

标签: android android-layout dialog scrollview


【解决方案1】:

对我有用的解决方案是将按钮从 ScrollView 中取出,并将它们放在 RelativeLayout 的顶层。通过将buttonbar先放在xml中,对齐到父底部,然后将scrollView的layout_above设置为buttonBar,就得到了我想要的效果

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多