我有一个巨大的项目列表,我将其放入线性布局,然后将其放入scrollview以使其可滚动。
然后我将其全部打包到相对视图中,因为我希望在底部有“添加”按钮。
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent">
<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">
A LOT OF CONTENT
</LinearLayout>
</ScrollView>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:id="@+id/add"
android:text="@string/add"
android:paddingTop="23dp"/>
</RelativeLayout>
由于每当我滚动到列表的最底部时,添加按钮都位于底部,因此添加按钮会阻止滚动视图最底部的部分。如何使scrollview只适合添加按钮不占用的屏幕部分?