我正在尝试使我的工具栏/操作栏透明。我可以看到一个透明的工具栏,但它隐藏在片段加载的小部件后面。小部件是图像的旋转木马。所以当图像翻转时,我可以看到它下方的工具栏。这是我的App主题。
<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>
这是我的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>
这是我的工具栏:
<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"/>
这是我的activity_drawer布局
<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>