2015-04-27 1 views
0

J'essaie de rendre ma barre d'outils/barre d'action transparente. Je peux voir une barre d'outils transparente mais elle se cache derrière le widget chargé par le fragment. Le widget est un carrousel d'images. Donc, quand l'image se retourne, je peux voir la barre d'outils en dessous. C'est le thème de mon application.La barre d'outils Android AppCompat Overlay se cache derrière le widget

<style name="AppTheme" parent="@style/Theme.AppCompat.Light"> 
    <item name="colorPrimary">#19b333</item> 
    <!-- ActionBar Theming --> 
    <item name="android:actionBarStyle">@style/MyActionBar</item> 

    <!-- Support library compatibility --> 
    <item name="actionBarStyle">@style/MyActionBar</item> 
</style> 

Ceci est mon thème ActionBar.

<style name="MyActionBar" parent="ThemeOverlay.AppCompat.Light"> 
    <item name="android:background">@color/color_primary</item> 
    <item name="android:windowActionBarOverlay">true</item> 

    <!-- Support library compatibility --> 
    <item name="background">@color/color_primary</item> 
    <item name="windowActionBarOverlay">true</item> 
</style> 

Et voici ma barre d'outils:

<android.support.v7.widget.Toolbar 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/toolbar" 
    android:layout_height="wrap_content" 
    android:layout_width="match_parent" 
    android:minHeight="?attr/actionBarSize"/> 

Ceci est mon activity_drawer mise en page

<android.support.v4.widget.DrawerLayout 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:id="@+id/drawer_layout" 
    tools:context=".activity.DrawerActivity"> 
    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" > 

     <include layout="@layout/view_toolbar"/> 

     <FrameLayout 
      android:id="@+id/content_frame" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" /> 
    </RelativeLayout> 

    <fragment 
     android:name="com.example.fragment.SidebarFragment" 
     android:id="@+id/sidebar" 
     android:layout_width="@dimen/sidebar_width" 
     android:layout_height="match_parent" 
     android:layout_gravity="start" 
     tools:layout="@layout/fragment_sidebar" /> 

</android.support.v4.widget.DrawerLayout> 

Répondre

2

Mettez la barre d'outils après le conteneur de contenu.

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" > 

    <FrameLayout 
     android:id="@+id/content_frame" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" /> 

    <include layout="@layout/view_toolbar"/> 

</RelativeLayout>