I'm trying to make it so that my toolbar will hide itself when I scroll a fragment containing a recycler view, inflated in a framelayout.
I've already tried changing the outermost relativelayout and coordinatorlayout and moving some things around, as well as adding scroll tags, none of which seemed to work (I'm probably doing them incorrectly).
Here's the layout of the activity in question:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
android:id="@+id/mainLayout"
android:background="@color/colorMain"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".MainActivity">
<FrameLayout
android:id="@+id/frag_container"
android:clipToPadding="true"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_below="@id/toolbar_top"
android:layout_above="@id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_above="@id/bottom_navigation"
app:rippleColor="@color/colorPrimary"
android:clickable="true"
android:layout_margin="18dp"
android:tint="@color/colorMain"
app:srcCompat="@drawable/ic_plus" />
<androidx.appcompat.widget.Toolbar
app:layout_constraintTop_toTopOf="parent"
android:id="@+id/toolbar_top"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
android:elevation="1dp"
android:background="@color/colorMain">
<ImageButton
android:id="@+id/accountButton"
android:layout_gravity="start"
android:tint="@color/colorSecondary"
android:background="?attr/selectableItemBackgroundBorderless"
app:srcCompat="@drawable/ic_account"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:contentDescription="@string/account" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/app_title"
android:textColor="@color/colorSecondary"
android:fontFamily="@font/productsansmedium"
android:textSize="20sp"
android:layout_gravity="center"
android:id="@+id/toolbar_title" />
</androidx.appcompat.widget.Toolbar>
<com.google.android.material.bottomnavigation.BottomNavigationView
android:theme="@style/Widget.BottomNavigationView"
android:background="@color/bottomNavColor"
app:itemIconTint="@drawable/navbar_color_selector"
app:itemTextColor="@drawable/navbar_color_selector"
app:elevation="20dp"
android:id="@+id/bottom_navigation"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:menu="@menu/bottom_nav_items" />
</RelativeLayout>
Thanks in advance for helping!