2017-02-04 5 views
0

Ich möchte nur meine Navigationsschublade unter Statusleiste bringen alles funktioniert gut, aber Problem ist meine Statusleiste ist Schatten.Android Statusleiste ist Schatten

enter image description here

Wie kann ich es transparent zu ändern, wie Play Store App.

Hier ist meine app Thema

<item name="colorPrimary">@color/colorPrimaryDark</item> 
<item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
<item name="colorAccent">@android:color/white</item> 
<item name="android:windowTranslucentStatus">true</item> 
<item name="android:windowTranslucentNavigation">true</item> 
<item name="windowActionBarOverlay">true</item> 
<item name="android:windowDrawsSystemBarBackgrounds">true</item> 

<item name="android:statusBarColor">?attr/colorControlHighlight</item> 

und Haupttätigkeit xml

<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"> 

    <!-- This LinearLayout represents the contents of the screen --> 
    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical"> 

     <!-- The ActionBar displayed at the top --> 
     <include 
      layout="@layout/toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" /> 

     <android.support.design.widget.TabLayout 
      android:id="@+id/tab_layout" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/toolbar" 
      android:background="?attr/colorPrimary" 
      android:elevation="0dp" 
      android:minHeight="?attr/actionBarSize" 
      android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/> 

     <android.support.v4.view.ViewPager 
      android:id="@+id/pager" 
      android:layout_width="match_parent" 
      android:layout_height="fill_parent" 
      android:layout_below="@id/tab_layout"/> 


     <!-- The main content view where fragments are loaded --> 
     <FrameLayout 
      android:id="@+id/flContent" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" /> 
    </LinearLayout> 


    <android.support.design.widget.NavigationView 
     android:id="@+id/nvView" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     app:headerLayout="@layout/nav_header" 
     android:fitsSystemWindows="false" 
     android:layout_gravity="start" 
     app:menu="@menu/drawer_view" /> 
</android.support.v4.widget.DrawerLayout> 
+0

Sie können diesem einfachen Tutorial folgen: https://github.com/codepath/android_guides/wiki/Fragment-Navigation-Drawer –

+0

mein Problem ist Statusleiste Farbe nicht wie man Navigationsschublade bauen –

+0

Können Sie den Code Ihres Layouts veröffentlichen? –

Antwort

0

Sie können einfach Android Statusleiste Farbe als transparent ändern. das wird dir helfen.

 Window window = activity.getWindow(); 
    window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); 
    window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); 

    /*----set color----*/ 
    window.setStatusBarColor(activity.getResources().getColor(R.color.my_statusbar_color)); 
0

ok ich fix it mein Selbst, wenn Sie all diese Zeilen ähnliches Problem entfernen, aus dem Thema

<item name="android:windowTranslucentStatus">true</item> 
<item name="android:windowTranslucentNavigation">true</item> 
<item name="windowActionBarOverlay">true</item> 
<item name="android:windowDrawsSystemBarBackgrounds">true</item> 

und fügen Sie einfach

android:fitsSystemWindows="true" 

zu Ihrem Haupt liniear Layout

+0

Das ist keine Lösung, Sie setzen nur die Farbe auf die gleiche wie die unterhalb der Ansichtsfarbe, um die Gesamtansicht als gleichfarbige Sache sichtbar zu machen! Dies funktioniert, solange Sie kein Hintergrundbild –

+0

setzen, das mein Problem behebt –

Verwandte Themen