我有这样的布局定制对话框:的Android定制对话框按下按钮关闭屏幕
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/mylayout">
<LinearLayout
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView ... />
<TextView .../>
</LinearLayout>
<ScrollView
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/title">
<LinearLayout ...>
<TextView ...
android:text="lots of text........" />
<TextView .../>
</LinearLayout>
</ScrollView
<RelativeLayout ...
android:layout_below="@+id/scrollView">
<Button ...>
<Button ...>
</RelativeLayout>
</RelativeLayout>
我的问题是,滚动型的是,当在滚动视图太多的文字中,下面的按钮被压出对话框。我已经能够通过使用android:layout_alignParentBottom =“true”将包含按钮的RelativeLayout锚定到底部来阻止它,但是当scrollview中的文本较少时,我会将整个对话框拉伸到屏幕底部,并且我不想那样。
我怎样才能得到一个布局是这样的:
[SOME TEXT]
[Scrollable region]
[Buttons]
尝试修复主要布局在像300dip –
的高度我并不想解决的主要布局的高度,因为它需要在不同屏幕尺寸和方向 –