0

I'm trying to only display a floating action button when the Recycler View position is at the very top. Is there any way I can achieve this?

Here is my current layout file:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:background="#BBB"
    android:layout_height="match_parent">

    <android.support.v7.widget.RecyclerView
        android:id="@+id/postsRecyclerView"
        android:layout_width="match_parent"
        android:scrollbars="vertical"
        android:layout_height="match_parent" />

    <android.support.design.widget.FloatingActionButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:layout_margin="16dp"
        android:src="@drawable/icon_post" />

</RelativeLayout>

Thanks

Farhana Naaz Ansari
  • 7,524
  • 26
  • 65
  • 105
Aidan Laing
  • 1,260
  • 11
  • 23

0 Answers0