2017-03-23 3 views
2

Dieses Problem, wie man damit umgehen kann, kann jemand damit umgehen, vielen Dank!Android Symbolleiste Navigation und Systemleiste? API 19

ich die windowTranslucentStatus wahr und die navigationDrawer ist in Ordnung, aber, meine toolbar und Systembalkenanzeige zusammen, so dass ich verwende eine Bibliothek systembartint namens die Systemleiste der Farbe zu ändern und das gleiche macht mit toolbar


und nachdem ich es verwenden, app so geworden:

enter image description here

diesmal Symbolleiste ok ist, aber navigationDrawer keine ist t ok, gibt es eine Hintergrundfarbe an der Spitze des navigationDrawer, was ich will, dies zu tun ist:

enter image description here

kann mir jemand helfen

+0

Dank tun können @ rafsanahmad007 zum Bearbeiten für mein Problem, das ist meine erste Zeit, eine Frage in stackoverflow zu stellen, nochmals vielen Dank! –

+0

Mögliches Duplikat von [Android DrawerLayout (mit NavigationView) hinter der Statusleiste] (http://stackoverflow.com/questions/41501857/android-drawerlayout-with-navigationview-behind-status-bar) –

+0

@RajeshKushvaha danke für deine Antwort, aber mein Gerät ist API 19, es kann immer noch nicht gut funktionieren –

Antwort

0

Wenn Ihr Telefon API 19 ist, das ist, was ich Sie, schreiben Sie zuerst Ihr Stil

<style name="DayTheme" parent="Theme.AppCompat.Light.NoActionBar"> 
     <!-- Customize your theme here. --> 
     <item name="colorPrimary">@color/primary</item> 
     <item name="colorPrimaryDark">@color/primary_dark</item> 
     <item name="colorAccent">@color/accent</item> 
     <item name="background">@color/white</item> 
     <item name="barTitleColor">@color/bar_title</item> 
     <item name="barColor">@color/primary</item> 
     <item name="textColor">@color/text_color</item> 
     <item name="textLight">@color/text_light</item> 
     <item name="textBright">@color/primary</item> 
     <item name="dividerColor">@color/dividerColor</item> 

    </style> 

dann die attr.xml:

<?xml version="1.0" encoding="utf-8"?> 
<resources> 
    <attr name="barTitleColor" format="color"/> 
    <attr name="textColor" format="color"/> 
    <attr name="textLight" format="color"/> 
    <attr name="textBright" format="color"/> 
    <attr name="dividerColor" format="color"/> 
    <attr name="barColor" format="color"/> 
</resources> 

dann meine UI xml:

<?xml version="1.0" encoding="utf-8"?> 
<android.support.design.widget.AppBarLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:app="http://schemas.android.com/apk/res-auto" 
     android:id="@+id/appbar" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:fitsSystemWindows="true" 
     android:background="?attr/barColor" 
     android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
     > 

     <android.support.v7.widget.Toolbar 
      app:contentInsetStart="0dp" 
      android:id="@+id/toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="?attr/actionBarSize" 
      android:background="@color/colorPrimary" 
      android:minHeight="?attr/actionBarSize" 
      app:layout_scrollFlags="scroll|enterAlways" 
      app:popupTheme="@style/ThemeOverlay.AppCompat.Light" 
      app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
      /> 

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

das ist, was ich von Leisure lernen,

android:background="?attr/barColor" 
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 

dies ist eine der Antworten, aber ich weiß nicht, warum es es

+0

TL; DR: Legen Sie 'android: fitSystemWindows =" true "' auf der AppBarLayout und DrawerLayout. –

+0

@EugenPechanec ich hatte jemals 'android: fitSystemWindows =" true "' gesetzt, aber es funktioniert nicht, [jetzt weiß ich warum] (http://stackoverflow.com/questions/27238433/when-should-one-use -theme-appcompat-vs-themeoverlay-appcompat) kann es funktionieren: D –

Verwandte Themen