2016-08-01 4 views

答えて

1

次の2つのツールバーsearch viewと1とwidgetsを持つものを使用することができます。

デザインは以下のようになります。

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

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

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

    <android.support.v7.widget.Toolbar 
    android:id="@+id/toolbar2" 
    android:layout_width="match_parent" 
    android:layout_height="?attr/actionBarSize" 
    android:background="?attr/colorPrimary"/> 

    <ImageButton 
    android:id="@+id/fabButton" 
    android:layout_width="56dp" 
    android:layout_height="56dp" 
    android:layout_gravity="bottom|right" 
    android:layout_marginBottom="16dp" 
    android:layout_marginRight="16dp" 
    android:background="@drawable/fab_background" 
    android:src="@drawable/ic_favorite_outline_white_24dp" 
    android:contentDescription="@null"/> 

</FrameLayout> 

あなたはここで良いのチュートリアルを見つけることができたCoordinatorLayoutを使用する必要が

enter image description here

Complete Demo of hide toolbar on scroll.

1

以下のように、あなたは、スクロールの1を非表示にすることができます:

Tutorial

あなたがそれを望むような行 app:layout_scrollFlags="scroll|enterAlways"がそれを作る

<android.support.design.widget.AppBarLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

      <android.support.v7.widget.Toolbar 
       .../> 
      <android.support.design.widget.TabLayout 
       android:id="@+id/tabLayout" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       app:layout_scrollFlags="scroll|enterAlways"/> 
     </android.support.design.widget.AppBarLayout> 

は簡単に言えば、あなたは(最初の子でなければなりません)AppBarLayoutが含まれており、AppBarLayoutはこのような2 chilrenを含まなければならないCoordinatorLayoutを持っている必要があります。

関連する問題