【发布时间】:2017-12-27 08:57:30
【问题描述】:
我有一个 ScrollView,里面有一些视图。如果 ScrollView 的内容高度小于屏幕高度,我想强制最后一个视图位于底部。我该怎么做?
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center_horizontal">
<View ... />
<View ... />
<View ... />
<View ... /> // this one should be on bottom if LinearLayout's contents don't exceed screen height
</LinearLayout>
</ScrollView>
【问题讨论】:
-
您是否尝试过使用相对布局并赋予属性 "align_parentBottom" = true ?
标签: android scrollview