1

In meiner App verwende ich AppBarLayout mit Toolbar drin als meine Unterstützung Aktionsleiste. Ich möchte, dass es angezeigt wird, wenn der Benutzer Inhalte scrollt. Auf KitKat funktioniert alles gut, aber auf Lollipop und Marshmallow Toolbar scrollt nicht seine volle Höhe. Screen with toolbar fully scrolledAndroid Toolbar nicht vollständig versteckt (> Lollipop)

Mein Layout:

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    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:context="(...)"> 

    <include 
     android:id="@+id/app__content" 
     layout="@layout/app_bar__main" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" /> 

    <fragment android:id="@+id/navigation_drawer" 
     android:layout_width="@dimen/navigation_drawer_width" 
     android:layout_height="match_parent" 
     android:layout_gravity="left" 
     android:fitsSystemWindows="true" 
     android:name="(...)" 
     tools:layout="@layout/fragment__navigation_drawer" /> 

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

app_bar__main.xml:

<?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/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="true" 
    tools:context="(...)"> 

    <android.support.design.widget.AppBarLayout 
     android:id="@+id/app__appbarlayout__action_bar_layout" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:theme="@style/AppTheme.AppBarOverlay"> 

     <android.support.v7.widget.Toolbar 
      android:id="@+id/app__toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="@dimen/action_bar__height" 
      android:background="@drawable/toolbar__background" 
      android:elevation="4dp" 
      app:layout_scrollFlags="scroll|enterAlways" 
      app:popupTheme="@style/AppTheme.PopupOverlay" 
      tools:ignore="UnusedAttribute" /> 

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

    <include layout="@layout/app_content__main" /> 

    <include android:id="@+id/app__layout__bottom_bar" 
     layout="@layout/layout__bottom_bar" /> 

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

app_content__main.xml ist nur FrameLayout, in die ich Fragmente bin hinzufügen. Ich benutze support:appcompat-v7:23.3.0 und support:design:23.2.0 (kann 23.3.0 wegen eines anderen Fehlers mit Symbolleiste nicht verwenden). Es funktionierte mit 23.0.0, aber gibt es irgendeine Möglichkeit, dass ich es tun kann, ohne zu dieser vorherigen Version zu wechseln?

Antwort

1

Sie müssen den Android: fitSystemWindows = "true" aus dem CoordinatorLayout löschen.

Verwandte Themen