2017-02-08 3 views
0

В деятельности у меня есть панель инструментов, и его код макета:панели перекрывает Полупрозрачный панель состояния

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" 
    tools:context="com.aminiam.moviekade.fragment.AllReviewFragment"> 

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

     <android.support.v7.widget.Toolbar 
      android:id="@+id/toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="?attr/actionBarSize" 
      android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" /> 

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

    <android.support.v7.widget.RecyclerView 
     android:id="@+id/recReview" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_below="@+id/toolbar"/> 

</LinearLayout> 

Я хочу иметь прозрачную строку состояния в моем приложении, и когда я добавить <item name="android:windowTranslucentStatus">true</item> к теме деятельности, панели инструментов будет перекрывать строку состояния.

значения-v21 style.xml:

<resources> 
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar"> 
    <!-- Customize your theme here. --> 
    <item name="colorPrimary">@color/colorPrimary</item> 
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
    <item name="colorAccent">@color/colorAccent</item> 
    <item name="android:windowBackground">@color/windowBackground</item> 
</style> 

<style name="TransparentStatusBar" parent="AppTheme"> 
    <item name="android:windowTranslucentStatus">true</item> 
</style> 

Я проверил все ответы в Stackoverflow, но они не могли решить эту проблему.

enter image description here

+0

Тема AppBarLayout должна быть 'app: theme =" @ style/AppTheme.AppBarOverlay "и добавить это в стиль'