2016-08-01 1 views

답변

1

두 도구 모음 search view 하나와 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> 

당신은 당신이 여기에 좋은 튜토리얼을 찾을 수있는

enter image description here

Complete Demo of hide toolbar on scroll.

1

당신은 CoordinatorLayout를 사용할 필요가 아래처럼 스크롤에 하나를 숨길 수 있습니다 :

Tutorial

간단히 말해

, 당신은 다음과 같이 두 chilren를 포함해야합니다 (수 있어야 최초의 아이)를 AppBarLayout를 포함하는 CoordinatorLayout과 AppBarLayout이 필요합니다 : 당신이 원하는 것처럼

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

라인 app:layout_scrollFlags="scroll|enterAlways" 그것을합니다.