【发布时间】:2016-01-16 07:29:06
【问题描述】:
我有一个相对布局填满整个屏幕。我想在它的中间添加一个滚动视图来包装一堆内容,以便在显示软键盘时让它平移。但是,一旦我将它包装在滚动视图中,最底部的布局就会停止填充屏幕的其余部分。
这是我将 ScrollView 注释掉的 XML。
<include
android:id="@+id/top_bar_with_save_button"
layout="@layout/top_bar_with_save_button"/>
<FrameLayout
android:id="@+id/log_entry_title_frame"
android:layout_below="@id/top_bar_with_save_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/log_entry_title_frame"
android:layout_alignParentBottom="true">
<!--
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
-->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/log_entry_title_frame"
android:orientation="vertical"
android:background="#f00">
<!-- Lots of stuff in here -->
<EditText
android:id="@+id/log_entry_notes"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="8dp"
android:gravity="top|left"/>
</RelativeLayout>
<!--
</ScrollView>
-->
</LinearLayout>
看起来像这样:
但是,一旦我从 ScrollView 中删除评论,它就会立即像这样压缩:
为什么会这样?我需要它来填充屏幕上的整个空间,但我无法弄清楚发生了什么。谁能告诉我如何解决这个问题?谢谢!
【问题讨论】:
标签: android android-layout android-scrollview