I have an app that has a recyclerView
and a button at the bottom of the recyclerView
.
When I am going down, the button is well displayed at the bottom of the recyclerView
, but when I am going up, the button stays displayed at the bottom of the screen, and does not stuck at the bottom of the recyclerView
. It takes few scroll-up to make it disappears.
Any idea how to make sure that the button always shows at the bottom of the recyclerView
and not staying at the bottom of the screen?
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:bind="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:background="@color/brand05">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/brand05"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/list_of_vehicles_rv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:scrollbars="none"
android:alignmentMode="alignBounds"
android:scrollbarThumbVertical="@color/gainsboro_00"
android:scrollbarSize="2dp"/>
<LinearLayout
android:id="@+id/editVehiclesLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintTop_toBottomOf="@id/list_of_vehicles_rv">
<View
android:layout_width="match_parent"
android:layout_height="50dp"/>
<include layout="@layout/widget_bottom_button"
android:id="@+id/button_add_vehicle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/cell_padding"
android:layout_marginEnd="@dimen/cell_padding"
android:layout_marginBottom="@dimen/cell_padding_bottom" />
<include layout="@layout/widget_bottom_button"
android:id="@+id/cancel_remove_vehicle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:layout_marginStart="@dimen/cell_padding"
android:layout_marginEnd="@dimen/cell_padding"
android:layout_marginBottom="@dimen/cell_padding_bottom"/>
<include layout="@layout/widget_bottom_button"
android:id="@+id/remove_selected_vehicle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:layout_marginStart="@dimen/cell_padding"
android:layout_marginEnd="@dimen/cell_padding"
android:layout_marginBottom="@dimen/cell_padding_bottom"/>
</LinearLayout>
<include
android:id="@+id/loading"
layout="@layout/layout_loading"/>
</androidx.appcompat.widget.LinearLayoutCompat>
</ScrollView>
Any idea how to fix it ?