我的布局
由一个包含所有内容的ScrollView
组成。在某些时候,我需要在屏幕底部 ScrollView 顶部(上方)显示一个 View
(因此 ScrollView
位于 View
),这样我就可以上下滚动屏幕,同时此 View
仍然粘在设备的屏幕底部。请建议大家如何进行这样的布局。谢谢。
最佳答案
如果您希望 ScrollView 位于 View 后面,可以这样做:
(部分代码复制自 this SO问题)
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:id="@+id/RelativeLayout1">
<ScrollView android:id="@+id/scrollView"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</ScrollView>
<View android:id="@+id/bottomView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:visibility="gone">>
</View>
</RelativeLayout>
ScrollView 现在将扩展到 View 元素之外。
关于android - 如何将 View 粘贴在屏幕底部以便上面的部分可以移动?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13628866/