希望动作栏变得透明但变得灰暗

时间:2015-01-21 08:19:15

标签: android android-actionbar transparent

我想将我的操作栏背景更改为透明而不是叠加,因为我想让我的操作栏从活动背景中获取其背景,并且只有边框底部将其与活动分开。 我试图制作自定义样式,动作栏背景透明,但它变成灰色。

这是我的自定义风格

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- the theme applied to the application or activity -->
    <style name="CustomActionBarTheme"
        parent="@style/Theme.AppCompat.Light.DarkActionBar">
        <item name="android:actionBarStyle">@style/MyActionBar</item>
        <item name="android:actionMenuTextColor">@color/putih</item>
        <item name="android:homeAsUpIndicator">@drawable/navigation_previous_item</item>
        <!-- Support library compatibility -->
        <item name="actionBarStyle">@style/MyActionBar</item>
        <item name="actionMenuTextColor">@color/putih</item>
        <item name="homeAsUpIndicator">@drawable/navigation_previous_item</item>
    </style>

    <!-- ActionBar styles -->
    <style name="MyActionBar"
        parent="@style/Widget.AppCompat.ActionBar">
        <item name="android:background">@android:color/transparent</item>

        <item name="android:titleTextStyle">@style/MyActionBarTitleText</item>

        <!-- Support library compatibility -->
        <item name="background">@android:color/transparent</item>
        <item name="titleTextStyle">@style/MyActionBarTitleText</item>
    </style>

    <!-- ActionBar title text -->
    <style name="MyActionBarTitleText"
        parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
        <item name="android:textColor">@color/putih</item>
        <!-- The textColor property is backward compatible with the Support Library -->
    </style>

</resources>

感谢您的帮助

0 个答案:

没有答案