2016-07-19 7 views
0

Hat eine leere weiße Leiste an der Spitze der Symbolleiste nur in Android MarshMallow-Versionen. Alle anderen Android-Versionen sind so eingestellt, dass sie korrekt angezeigt werden.Leere Leiste oben in der Symbolleiste in Android Marshmallow

+0

Haben Sie versucht, NoActionBar Thema zu verwenden und Toolbar durch Layout bereitzustellen? –

+0

ich benutze das gleiche Thema bro .. –

+0

Sorry notierte nicht include-Tag. –

Antwort

1

Dieser Grund in meinem Code Verwendung von BottomBar Plugin erhöht wird https://github.com/roughike/BottomBar Das Problem direkt in der Dokumentation gelöst

Warum hat die Spitze meines Inhalt sooooo viel leeren Raum haben ?!

Wahrscheinlich, weil Sie einige fortgeschrittene Android-Sachen der nächsten Ebene (wie CoordinatorLayout und FitSystemWindows = "true") machen und die normalen Paddings für den Inhalt zu viel sind. Fügen Sie dieses Recht nach dem Aufruf von attach() hinzu:

mBottomBar.noTopOffset();

+0

** Vielen Dank **, ich habe Haare aus meinem Kopf gezogen, ich konnte nicht herausfinden, was los war! – wzieba

0

Sie müssen DrawerLayout als parent von allen setzen. Also setze DrawerLayout so wie ich Antwort unten gepostet habe. Dies ist die grundlegende Struktur, die ich poste.

Nur ein Beispiel:

<?xml version="1.0" encoding="utf-8"?> 
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
android:id="@+id/drawer_layout" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:fitsSystemWindows="true"> 

<android.support.design.widget.CoordinatorLayout 
    android:id="@+id/coordinator" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"> 

    <android.support.design.widget.AppBarLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:fitsSystemWindows="true" 
     android:theme="@style/AppTheme.AppBarOverlay" 
     app:elevation="0dp"> 

      <android.support.v7.widget.Toolbar 
       android:id="@+id/toolbar" 
       android:layout_width="match_parent" 
       android:layout_height="?attr/actionBarSize" 
       android:background="?attr/colorPrimary" 
       android:elevation="0dp" 
       android:minHeight="?attr/actionBarSize" 
       app:layout_collapseMode="pin" 
       app:popupTheme="@style/AppTheme.PopupOverlay"> 

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


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

    <FrameLayout 
     android:id="@+id/content_frame" 
     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" 
    app:headerLayout="@layout/app_nav_header_main" 
    app:menu="@menu/main_drawer" /> 

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

Nein, immer noch gibt es keine Änderung, aber aufgrund der Änderung der Schublade Layout als root es kommt heraus leerer Raum .. :( –

+0

@VenkatRamana Vergleichen Sie die Struktur, die Sie tun es total falsch? – Ironman

+0

Nein, es funktioniert perfekt in allen anderen Android-Versionen, das Problem ist nur mit Marshmallow-Versionen –

0

Haben Sie hinzugefügt android: fitsSystemWindows = "true" zu Ihren Eltern?

<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:id="@+id/main_content" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

     <!--Toolbar--> 
     <android.support.design.widget.AppBarLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:theme="@style/AppTheme.AppBarOverlay"> 
      <android.support.v7.widget.Toolbar 
       android:id="@+id/toolbar" 
       android:layout_width="match_parent" 
       android:layout_height="?attr/actionBarSize" 
       android:background="?attr/colorPrimary" 
       app:popupTheme="@style/AppTheme.PopupOverlay" /> 

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

     <!--================ CONTENT ================--> 
      <!-- PUT SOMETHING --> 
     <!--/ ================ END CONTENT ================--> 
    </android.support.design.widget.CoordinatorLayout> 


    <!--Drawer--> 
    <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_base" 
     app:menu="@menu/activity_base_drawer" /> 

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