相关疑难解决方法(0)

Android RelativeLayout:如何在ScrollView中包装alignParentBottom?

我遇到的问题似乎是,如果我在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>   
Run Code Online (Sandbox Code Playgroud)

android

31
推荐指数
2
解决办法
3万
查看次数

标签 统计

android ×1