I'm using coordinator layout, recycler view and floating button. Somehow, the fab button doesn't stay at the bottom of the layout. I would like the button to stay at the bottom even in scrolling. What I do know, is that the fab button takes the bottom position of the last item in recycler view.
list-activity.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
tools:listitem="@layout/activity_sample_05borangb_parent"
android:id="@+id/recyclerView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical"/>
</RelativeLayout>
<android.support.design.widget.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:foregroundGravity="bottom"
android:layout_gravity="bottom|end"/>
</android.support.design.widget.CoordinatorLayout>
Try this :
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical"/>
</RelativeLayout>
<android.support.design.widget.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:foregroundGravity="bottom"
android:layout_margin="16dp"
android:layout_gravity="bottom|end"/>
</android.support.design.widget.CoordinatorLayout>