2016-07-22 18 views
0

最初のフラグメント(タブ)をタップすると2つのフラグメントを含むアクティビティが1つありますが、それは正常にスクロールする必要がありますが、あなたがthis.XML含む知っている場合ので、私を助けて、私はそのタブにしたい2つのだけのフラグメントタブをツールバーレイアウトを潰したい親アクティビティの折りたたみツールバーレイアウトを子フラグメントから外す

enter code here 

<android.support.design.widget.AppBarLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:fitsSystemWindows="true" 
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> 


    <android.support.design.widget.CollapsingToolbarLayout 
     android:id="@+id/collapse_toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="250dp" 
     android:fitsSystemWindows="true" 
     app:contentScrim="?attr/colorPrimary" 
     app:layout_scrollFlags="scroll|exitUntilCollapsed"> 


     <ImageView 
      android:id="@+id/header" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="#424242" 
      android:fitsSystemWindows="true" 
      android:scaleType="centerCrop" 

      app:layout_collapseMode="parallax" /> 

     <android.support.v7.widget.Toolbar 
      android:id="@+id/toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:gravity="top" 

app:layout_collapseMode="pin" 
      /> 


     <Relative-layout 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      "> 

      <Text-view 
      /> 

     <Text-view 

       /> 

      <View 
       android:id="@+id/view" 
       android:layout_width="wrap_content" 
       android:layout_height="2dp" 
       /> 

      <Image View 

      /> 

     </RelativeLayout> 

     <android.support.design.widget.TabLayout 
      android:id="@+id/tabs 
      android:layout_gravity="bottom" 
      /> 

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

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


<android.support.v4.view.ViewPager 

    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" /> 

<android.support.design.widget.FloatingActionButton 

    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_gravity="bottom|end" 
    /> 

答えて

0

TabSelectedリスナーを設定し、2番目のタブが選択されている場合はツールバーをappBarLayout.SetExpanded(false, true);で折り畳んで、その高さを小さく設定します。
hereおよびhereを参照してください。

関連する問題