I'm trying to hide my Toolbar on the RecyclerView scroll and so far it seems to have hidden, but it's leaving a white blank with it. I'm pretty sure this has something to do with the overlay of my MainActivity's layout and the fragment in the FrameLayout.

![why is this happening to me ._.](https://i.stack.imgur.com/Np1ie.gif)

Here is my `activity_main.xml`. I need the FrameLayout because I am loading different fragments with selection of an item in the Navigation Drawer.

```
<android.support.v4.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/drawer"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:elevation="7dp"
    tools:context=".MainActivity"
    android:fitsSystemWindows="true">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <include layout="@layout/toolbar" />

        <FrameLayout
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#FFFFFF" />

    </LinearLayout>

    <android.support.design.widget.NavigationView
        android:id="@+id/navigation_view"
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:layout_gravity="start"
        app:headerLayout="@layout/header"
        app:menu="@menu/drawer" />

</android.support.v4.widget.DrawerLayout>

```

And here is the code in the fragment that contains the RecyclerView.

```
...
@Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View v = inflater.inflate(R.layout.fragment_main, container, false);

        getActivity().setTitle("Unit One");

        rv = (RecyclerView) v.findViewById(R.id.rv);
        rv.setHasFixedSize(true);

        llm = new LinearLayoutManager(getActivity());
        rv.setLayoutManager(llm);

        initializeData();
        initializeAdapter();

        rv.addOnScrollListener(showHideToolbarListener = new RecyclerViewUtils.ShowHideToolbarOnScrollingListener(MainActivity.toolbar));

        if (savedInstanceState != null) {
            showHideToolbarListener.onRestoreInstanceState((RecyclerViewUtils.ShowHideToolbarOnScrollingListener.State) savedInstanceState
                    .getParcelable(RecyclerViewUtils.ShowHideToolbarOnScrollingListener.SHOW_HIDE_TOOLBAR_LISTENER_STATE));
        }

        return v;
    }

    @Override
    public void onSaveInstanceState(Bundle outState) {
        outState.putParcelable(RecyclerViewUtils.ShowHideToolbarOnScrollingListener.SHOW_HIDE_TOOLBAR_LISTENER_STATE,
                showHideToolbarListener.onSaveInstanceState());
        super.onSaveInstanceState(outState);
    }

```

And lastly, the RecyclerView layout in `fragment_main.xml`:

```
 <android.support.v7.widget.RecyclerView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingLeft="8dp"
        android:paddingRight="8dp"
        android:orientation="vertical"
        android:scrollbars="vertical"
        android:id="@+id/rv" />

```

This is a follow up to my [other post](https://stackoverflow.com/questions/31218254/toolbar-not-hiding-on-recyclerview-scroll), but I wanted to ask a new question since I'm trying a [different method](http://rylexr.tinbytes.com/2015/04/27/how-to-hideshow-android-toolbar-when-scrolling-google-play-musics-behavior/) this time (don't read the entire post, see the edit at the bottom). Here is his [MainActivity](https://github.com/rylexr/android-show-hide-toolbar/blob/master/app/src/main/java/com/tinbytes/samples/showhidetoolbar/MainActivity2.java) and the actual [scrolling listener code](https://github.com/rylexr/android-show-hide-toolbar/blob/master/app/src/main/java/com/tinbytes/samples/showhidetoolbar/util/RecyclerViewUtils.java).

I apologize if this seems like me saying "here's my shit go fix it" but I've spent almost two hours searching for a possible solution to this. **As always, I appreciate the help greatly.**