我遇到的问题似乎是这样的:如果我在RelativeLayout中有一个视图(例如myButton),设置为alignParentBottom - 如下所示的代码 - 然后用scrollview包装RelativeLayout(必要,以便在较小的屏幕或方向更改为横向时可以查看内容),则当父底部不可见时(例如更改为横向方向),myButton将显示在页面顶部,而不是底部。
如何对齐视图到屏幕底部并使其保留在底部,即使底部低于滚动条?
<ScrollView
android:id="@+id/mainScrollView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:fillViewport="true">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/topLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
... lots of views and stuff
<Button android:layout_alignParentBottom="true"
android:id="@+id/myButton"
android:text="Click Me" />
</RelativeLayout>
</ScrollView>