0

I have this very simple layout:

<android.support.design.widget.CoordinatorLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/tools"
    android:id="@+id/root"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/ActionBarThemeOverlay">

        <!--<include layout="@layout/include_toolbar_actionbar" />-->

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:layout_scrollFlags="scroll|enterAlways" />

    </android.support.design.widget.AppBarLayout>

    <FrameLayout
        android:id="@+id/fragment_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/background"
        app:layout_behavior="@string/appbar_scrolling_view_behavior" />

</android.support.design.widget.CoordinatorLayout>

I add a Fragment with a standard RecyclerView into fragment_container. Unfortunately, the Toolbar is always hide, I can't understand why?

Thank you very much for your help guys!

Ahmer Afzal
  • 501
  • 2
  • 11
  • 24
anthony
  • 7,653
  • 8
  • 49
  • 101

1 Answers1

0

You could try this: solution from similar question.

Basically, you have to use android.support.v4.widget.NestedScrollView instead of ScrollView (in your fragment) and implement app:layout_behavior="@string/appbar_scrolling_view_behavior" inside your NestedScrollView xml.

Community
  • 1
  • 1
Dejvid
  • 470
  • 2
  • 13