2017-02-04 8 views
0

Я просто хочу, чтобы мой навигационный ящик находился под строкой состояния, все прекрасно работает, но проблема в том, что моя строка состояния - тень.Строка состояния Android - тень

enter image description here

Как я могу изменить его прозрачным, как игра Маркете.

Вот мое приложение тема

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

и основная деятельность 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

Вы можете выполнить этот простой учебник: https://github.com/codepath/android_guides/wiki/Fragment-Navigation-Drawer –

+0

моя проблема - цвет строки состояния не как построить навигационный ящик –

+0

Можете ли вы опубликовать код вашего макета? –

ответ

0

Вы можете просто изменить цвет Android строку состояния прозрачным. это поможет вам.

 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

хорошо я это исправить мой сам, если у вас есть подобная проблема удалить все эти строки из вашей темы

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

и просто добавить

android:fitsSystemWindows="true" 

к вашей основной раскладке liniear

+0

Это не исправление, вы просто устанавливаете цвет таким же, как ниже цвета представления, чтобы сделать общий вид видимым как вещь одного цвета! Это будет работать до тех пор, пока вы не установите фонового изображения –

+0

, которые исправят мою проблему –

 Смежные вопросы

  • Нет связанных вопросов^_^