0
soll

ich meine AppBarLayout vor kurzem änderte sich mit SmoothAppBarLayoutSmoothAppBarLayout kollabiert Symbolleiste Höhe ist größer als

Es ist glatter und schneller, so bin ich mit dem Ergebnis zufrieden. Aber das hat irgendwie meine Werkzeugleistenhöhe verändert und ich konnte es noch nicht beheben.

Die Höhe des minimierten ToolBars sollte "actionBarSize" sein, ist aber größer.

Es geht nicht um Symbolleistentitel, Deaktivieren oder Ändern der Auffüllung von es funktioniert nicht. Aber es geht um das Verhalten.

Einstellung eines neuen Verhaltens wie unten löst das Problem, aber ich möchte eine ordnungsgemäße Lösung.

AppBarLayout.Behavior behavior = new AppBarLayout.Behavior(); 
    params.setBehavior(behavior); 

Das erste Bild zeigt die beabsichtigte Größe, das zweite zeigt die tatsächliche Größe.

Intended CollapsedToolbar size Results in bigger toolbar size

Hier ist der Teil meiner XML: (nicht alle davon gelegt hat, da es ziemlich lang ist)

<me.henrytao.smoothappbarlayout.SmoothAppBarLayout 
     android:id="@+id/appbar" 
     android:layout_width="match_parent" 
     android:layout_height="210dp" 
     android:minHeight="50dp" 
     android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
     app:sabl_target_id="@id/nestedScrollView"> 

     <android.support.design.widget.CollapsingToolbarLayout 
      android:id="@+id/collapsingToolbarLayout" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:background="@color/transparent" 
      android:fitsSystemWindows="true" 
      android:minHeight="210dp" 
      app:contentScrim="@color/dark_gray_actionbar" 
      app:layout_scrollFlags="scroll|exitUntilCollapsed"> 

      <RelativeLayout 
       android:layout_width="match_parent" 
       android:layout_height="210dp" 
       android:orientation="vertical" 
       app:layout_collapseMode="parallax"> 

       <ImageView 
        android:id="@+id/serviceImage" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:contentDescription="Servis Fotoğrafı" 
        android:scaleType="centerCrop" 
        android:src="@drawable/gray_color_gradient" 
        app:layout_collapseMode="parallax" /> 
      </RelativeLayout> 

      <android.support.v7.widget.Toolbar 
       android:id="@+id/toolbar" 
       android:layout_width="match_parent" 
       android:layout_height="?actionBarSize" 
       android:layout_alignParentTop="true" 
       android:layout_gravity="center_horizontal" 
       app:layout_collapseMode="pin"> 

      </android.support.v7.widget.Toolbar> 
     </android.support.design.widget.CollapsingToolbarLayout> 
    </me.henrytao.smoothappbarlayout.SmoothAppBarLayout> 

    <include 
     layout="@layout/get_quote_layout" 
     android:layout_width="match_parent" 
     android:layout_height="64dp" 
     app:layout_anchor="@id/nestedScrollView" 
     app:layout_anchorGravity="bottom" 
     app:layout_collapseMode="pin" /> 


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

Antwort

1

Ich denke, das Problem von fitSystemWindows kommt. Sie können Ihr Layout wie folgt vereinfachen:

... 
<me.henrytao.smoothappbarlayout.SmoothAppBarLayout 
    android:id="@+id/appbar" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
    app:sabl_target_id="@id/nestedScrollView"> 

    <android.support.design.widget.CollapsingToolbarLayout 
     android:id="@+id/collapsingToolbarLayout" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:background="@color/transparent" 
     app:contentScrim="@color/dark_gray_actionbar" 
     app:layout_scrollFlags="scroll|exitUntilCollapsed"> 

     <RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="210dp" 
      android:orientation="vertical" 
      app:layout_collapseMode="parallax"> 

      <ImageView 
       android:id="@+id/serviceImage" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:contentDescription="Servis Fotoğrafı" 
       android:scaleType="centerCrop" 
       android:src="@drawable/gray_color_gradient" 
       app:layout_collapseMode="parallax" /> 
     </RelativeLayout> 

     <android.support.v7.widget.Toolbar 
      android:id="@+id/toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="?actionBarSize" 
      android:layout_alignParentTop="true" 
      android:layout_gravity="center_horizontal" 
      app:layout_collapseMode="pin"> 

     </android.support.v7.widget.Toolbar> 
    </android.support.design.widget.CollapsingToolbarLayout> 
</me.henrytao.smoothappbarlayout.SmoothAppBarLayout> 
... 
+0

Vielen Dank, ich habe es nie bemerkt, während alle anderen Sachen einchecken. Es hat mein Problem gelöst :) –