0

を動作しませんが、私はこの非常にシンプルなレイアウトがあります。 アンドロイド:表示/非表示ツールバーのスクロールが

<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> 

は私が fragment_containerに標準 RecyclerViewFragmentを追加します。残念ながら、 Toolbarは常に非表示になっていますが、なぜわかりませんか?

ご協力いただきありがとうございます。

答えて

0

あなたはこの試みることができる:基本的に、あなたは(あなたのフラグメントで)android.support.v4.widget.NestedScrollViewの代わりScrollViewを使用し、NestedScrollView XML内app:layout_behavior="@string/appbar_scrolling_view_behavior"を実装する必要がsolution from similar question.

を。

関連する問題