2016-08-27 4 views
0

ich eine CollapsingToolbarLayout bin die Schaffung und es sollte wie folgt aussehen:CollapsingToolbarLayout Konstruktionsfehler

enter image description here

Aber es hat dieses hässliche blaue „Ding“ darunter: enter image description here

Und hier ist der XML (es ist in einem coordinatorlayout, aber es wegschneiden geworden ist.):

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

    <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" 
     android:fitsSystemWindows="false" 
     app:contentScrim="?attr/colorPrimary" 
     app:expandedTitleMarginStart="48dp" 
     app:expandedTitleMarginEnd="64dp"> 

     <ImageView 
      android:id="@+id/post_view_photo" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:scaleType="centerCrop" 
      android:fitsSystemWindows="true" 
      android:transitionName="@string/transition_image" 
      app:layout_collapseMode="parallax" /> 

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

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

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

<android.support.v4.widget.NestedScrollView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical" 
     android:paddingTop="24dp"> 

     <android.support.v7.widget.CardView 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_margin="@dimen/card_margin"> 

      <LinearLayout 
       android:layout_width="match_parent" 
       android:orientation="vertical" 
       android:layout_height="wrap_content"> 

       <TextView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:text="Info" 
        android:textAppearance="@style/TextAppearance.AppCompat.Title" /> 

       <TextView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:text="test" /> 

      </LinearLayout> 

     </android.support.v7.widget.CardView> 





    </LinearLayout> 

</android.support.v4.widget.NestedScrollView> 

<android.support.design.widget.FloatingActionButton 
    android:layout_height="wrap_content" 
    android:layout_width="wrap_content" 
    android:src="@android:drawable/stat_notify_chat" 
    app:layout_anchor="@id/appbar" 
    app:layout_anchorGravity="bottom|right|end" 
    android:layout_margin="@dimen/fab_margin" 
    android:clickable="true"/> 

Was könnte der Fehler sein? Ich habe auch ein vertikales Bild ausprobiert. Vielen Dank!

+0

Haben Sie zu löschen versucht 'android: fitsSystemWindows = "true"' Attribut aus 'CollapsingToolbarLayout'? –

+0

Haben Sie das CollapsingToolbarLayout in einem AppBarLayout platziert? – Robbe

+0

@Yasin Kaçmaz ja, ich habe es versucht. – user6586661

Antwort

0

Ich habe ein Layout wie Sie, können Sie mit diesem Layout-Struktur versuchen, denke ich android:layout_below="@+id/profileactivity_appbar" Zugabe wurde behoben mein Problem

Auch Sie haben keine Scroll Fahnen in Ihrem Toolbar

Eine andere Sache, ich sehe; stellen Sie sicher, Ihr Übergang wandelt Bild richtig:

<?xml version="1.0" encoding="utf-8"?> 
<android.support.design.widget.CoordinatorLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/profileCoordinatorLayout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

<android.support.design.widget.AppBarLayout 
    android:id="@+id/profileactivity_appbar" 
    android:layout_width="match_parent" 
    android:layout_height="360dp" 
    android:theme="@style/AppTheme3.AppBarOverlay"> 

    <android.support.design.widget.CollapsingToolbarLayout 
     android:id="@+id/profileactivity_collapsing_toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     app:layout_scrollFlags="scroll|enterAlways|snap|enterAlwaysCollapsed" 
     app:statusBarScrim="@color/ColorPrimaryDark" 
     app:contentScrim="?attr/colorPrimary" 
     app:expandedTitleMarginStart="48dp" 
     app:expandedTitleMarginEnd="64dp"> 

     <ImageView 
      android:id="@+id/profileactivity_fullimage" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:scaleType="centerCrop" 
      app:layout_collapseMode="parallax" /> 

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

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

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

<android.support.v7.widget.RecyclerView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:id="@+id/profile_recyclerview" 
    android:layout_below="@+id/profileactivity_appbar" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" /> 


</android.support.design.widget.CoordinatorLayout> 
Verwandte Themen