我在"标题/正文/页脚"中有一个RelativeLayout
结构样式。
在标题部分,我有TextView
显示当前片段的标题;
正文包含ScrollView
元素包裹RelativeLayout
,其中包含其他元素;
最后,页脚只有一个Button
。
具体来说,结构如下:
<RelativeLayout>
<TextView /> <!-- the header -->
<ScrollView> <!-- the body -->
<RelativeLayout>
<!-- other elements -->
</RelativeLayout>
</ScollView>
<Button /> <!-- the footer -->
</RelativeLayout>
现在,我希望按钮始终位于主RelativeLayout
的底部,因此我分配了属性android:layout_alignParentBottom="true"
。
此外,ScrollView
必须填写所有正文,因此已设置属性android:fillViewport="true"
。
问题:事实是,页脚中的按钮会越过ScrollView
的最后一部分,从而隐藏包含正文的RelativeLayout
的最终元素。有没有解决方案来解决这个问题?
答案 0 :(得分:5)
尝试设置
android:layout_above="@+id/id_of_your_button"
ScrollView上的