Android 操作栏菜单颜色应用于所有应用程序,而不是仅应用于菜单

Android 操作栏菜单颜色应用于所有应用程序,而不是仅应用于菜单,android,Android,我下面是一个简单的如何改变动作栏的颜色 当我在我的“样式”文件中添加以下代码时,背景将全部变为蓝色。我只需要在动作栏上显示颜色 styles.xml <resources> <!-- Base application theme, dependent on API level. This theme is replaced by AppBaseTheme from res/values-vXX/styles.xml on newer d

我下面是一个简单的如何改变动作栏的颜色

当我在我的“样式”文件中添加以下代码时,背景将全部变为蓝色。我只需要在动作栏上显示颜色

styles.xml

<resources>

    <!--
        Base application theme, dependent on API level. This theme is replaced
        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
    -->
    <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">

        <!--
            Theme customizations available in newer API levels can go in
            res/values-vXX/styles.xml, while customizations related to
            backward-compatibility can go here.
        -->
    </style>

    <!-- Application theme. -->

<style name="AppTheme" parent="AppBaseTheme">
        <!-- All customizations that are NOT specific to a particular API-level can go here. -->

</style>
 <style name="MyActionBarTheme" parent="AppBaseTheme">
        <item name="android:background">#87CEFA</item>
    </style>
</resources>

#87CEFA
这是舱单

 <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/MyActionBarTheme"
                 >


我做错了什么

不要在清单中使用
MyActionBarTheme
。这将设置整个应用程序的背景。相反,请继续使用
AppTheme
。正如本教程所说,您应该通过将
@style/ActionBar
添加到
AppTheme
来引用
MyActionBarTheme
。这样可以确保设置的背景仅应用于动作栏样式