2016-10-18 12 views
1

ToolbarImageViewToolbar(これはサイドの引き出しメニューのこの3つのアイコンと矛盾しています)です。 ImageViewは、ツールバーは、私がImageViewすべてを削除all.Whenで表示されていない私がしたいだけのよう崩れけど...されて(私はツールバーが正常に表示されることを意味する)で結構です。折りたたみツールバーとImageView - ツールバーが表示されません

これは私のコードです:

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" android:id="@+id/drawer_layout" 
    android:layout_width="match_parent" android:layout_height="match_parent" 
    android:fitsSystemWindows="true" tools:openDrawer="start"> 

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

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


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

      <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" 
       app:popupTheme="@style/AppTheme.PopupOverlay" /> 




      <ImageView 
       android:layout_width="380dp" 
       android:layout_height="320dp" 
       android:background="@drawable/plant2" 
       android:fitsSystemWindows="true" 
       android:scaleType="centerCrop" 
       app:layout_collapseMode="parallax"/> 

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

     <android.support.design.widget.TabLayout 
      android:id="@+id/tabs" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      app:tabMode="fixed" 
      app:tabGravity="fill"/> 
    </android.support.design.widget.AppBarLayout> 

    <android.support.v4.view.ViewPager 
     android:id="@+id/viewpager" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior" /> 
</android.support.design.widget.CoordinatorLayout> 
    <android.support.design.widget.NavigationView android:id="@+id/nav_view" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:layout_gravity="start" 
     android:fitsSystemWindows="true" 
     app:headerLayout="@layout/nav_header_layout" 
     app:menu="@menu/activity_main_drawer" /> 
    </android.support.v4.widget.DrawerLayout> 
+0

これを確認してください。https://stackoverflow.com/questions/32853112/android-toolbar-collapsemode-issue – Raghavendra

答えて

1

あなたがアプリを使用する必要があります:layout_scrollFlags = "スクロール| exitUntilCollapsed" CollapsingToolbarLayout内部

やアプリを使用します。layout_collapseModeツールバー内側= "ピン"

<android.support.design.widget.CollapsingToolbarLayout 
    android:id="@+id/collapsing_toolbar" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    app:layout_scrollFlags="scroll|exitUntilCollapsed" 
    app:contentScrim="?attr/colorPrimary" > 

    <FrameLayout 
     android:layout_width="match_parent" 
     android:layout_height="250dp" 
     app:layout_collapseMode="parallax" 
     app:layout_collapseParallaxMultiplier="0.7" > 

     <ImageView 
      android:id="@+id/backdrop" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:scaleType="centerCrop" /> 

     <View 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="#20000000" /> 
    </FrameLayout> 

    <android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="?attr/actionBarSize" 
     app:layout_collapseMode="pin" 
     app:popupTheme="@style/ThemeOverlay.AppCompat.Light" > 

     <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Application Title" 
      android:textColor="#fff" 
      android:textSize="18sp" /> 
    </android.support.v7.widget.Toolbar> 

</android.support.design.widget.CollapsingToolbarLayout> 
関連する問題