I'm developing an android app with Android Studio and I'm having problems using a floating button on top of a recycler view. What I want to achive is to have a floating button on top of my recycler view and when I scroll to the bottom of the recycler view the button should not cover the last item on my list.
If I add padding or margin to my recycler view this is what i get:
And without padding nor margin this is the result:
My goal is to get this when scrolling to the last item:
And this when I am not in the last item:
This is the code I currently have:
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
tools:context=".frontend.MainActivity">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/activityList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animationCache="true"
android:background="@color/white"
android:layout_marginTop="10dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/addRoutine"
style="@style/Widget.AppCompat.Button"
android:layout_width="60dp"
android:layout_height="60dp"
android:background="@drawable/round_button"
app:iconPadding="0dp"
android:layout_marginBottom="10dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
I would really appreciate if someone could tell how this is achived.
Thank you!



