将主题应用于v7支持操作栏

Cha*_*ake 6 android android-theme android-actionbar android-support-library

我正在使用支持v7库ActionBar在我的应用程序中实现..我在我的styles.xml文件中有这个

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
    <style name="AppTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
        <item name="android:actionBarStyle">@style/ActionBarTheme</item>
    </style>
    <style name="ActionBarTheme" parent="android:Widget.ActionBar">
        <item name="android:background">#FFFF0000</item>
    </style>
</resources>
Run Code Online (Sandbox Code Playgroud)

然而,Eclipse抱怨actionBarStyle道.错误是这一个:

android:actionBarStyle requires API level 11 (current min is 8)

如何将我的主题应用于API级别8-10?

hit*_*dos 11

您需要提供两个API特定的styles.xml.在您的values/styles.xml中使用

<style name="AppTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
        <item name="actionBarStyle">@style/ActionBarTheme</item>
</style>
Run Code Online (Sandbox Code Playgroud)

并在你的values-v14/styles.xml中使用

<style name="AppTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
        <item name="android:actionBarStyle">@style/ActionBarTheme</item>
</style>
Run Code Online (Sandbox Code Playgroud)