ScrollView 内的 RelativeLayout,按钮与 parent 底部对齐
RelativeLayout inside ScrollView with a button aligned to bottom of its parent
我有一个 RelativeLayout
结构的 "header/body/footer" 风格。
在 header 部分我有一个 TextView
显示当前片段的标题;
body 包含一个 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
必须填满所有body,所以属性android:fillViewport="true"
已经设置。
问题:事实是页脚中的按钮越过了 ScrollView
的最后一部分,从而隐藏了 [=12= 的最后一个元素] 包含 body。有解决这个问题的方法吗?
尝试设置
android:layout_above="@+id/id_of_your_button"
在滚动视图上
我有一个 RelativeLayout
结构的 "header/body/footer" 风格。
在 header 部分我有一个
TextView
显示当前片段的标题;body 包含一个
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
必须填满所有body,所以属性android:fillViewport="true"
已经设置。
问题:事实是页脚中的按钮越过了 ScrollView
的最后一部分,从而隐藏了 [=12= 的最后一个元素] 包含 body。有解决这个问题的方法吗?
尝试设置
android:layout_above="@+id/id_of_your_button"
在滚动视图上