0

J'ai un problème avec la création de mon Barre d'étattransparent respectivement translucide. J'utilise AppCompat v22 Thème. Je veux utiliser windowTranslucentStatus pour API> = 19. J'ai vraiment cherché des réponses sur stackoverflow, mais je n'ai pas trouvé de solution à mon problème. Je pense que le plus simple est de vous montrer mon code et les captures d'écran de mon smartphone avec lequel j'ai testé l'application.Problème avec windowTranslucentStatus avec AppCompat v22

<RelativeLayout 
      android:id="@+id/activitylayout" 
      android:fitsSystemWindows="true" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent"> 

Au-dessus du code pour ma mise en page d'activité.

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> 

    <item name="colorPrimary">@color/primary</item> 
    <item name="colorPrimaryDark">@color/primary_dark</item> 
    <item name="colorAccent">@color/accent</item> 
    <item name="drawerArrowStyle">@style/drawerarrowstyle1</item> 
    <item name="android:windowTranslucentStatus">true</item> 
    <item name="android:fitsSystemWindows">true</item> 

Mon code style.xml (v19). Problème: Ma barre d'état a un arrière-plan blanc et n'est pas visible dans le tiroir de navigation.

Screenshot of the Status Bar in Activity Layout

Screenshot of Status Bar in Navigation Drawer

Répondre

0

Trois choses me aider dans le même problème.

  1. Corriger le fichier de disposition. Affichage défilable au-dessus de l'Appbar.

     <! -- Your Scrollable View --> 
        <android.support.v7.widget.RecyclerView 
          android:layout_width="match_parent" 
          android:layout_height="match_parent" 
          app:layout_behavior="@string/appbar_scrolling_view_behavior" /> 
    
        <android.support.design.widget.AppBarLayout 
          android:layout_width="match_parent" 
          android:layout_height="wrap_content"> 
        <android.support.v7.widget.Toolbar 
            ... 
            app:layout_scrollFlags="scroll|enterAlways"> 
    
         <android.support.design.widget.TabLayout 
            ... 
            app:layout_scrollFlags="scroll|enterAlways"> 
        </android.support.design.widget.AppBarLayout> 
    </android.support.design.widget.CoordinatorLayout> 
    
  2. android:fitsSystemWindows="true|false"

  3. Définir style:

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

exacte votre problème probablement au point 2.