将主题应用到V7支持操作栏 [英] Applying a theme to v7 Support Action Bar

查看:239
本文介绍了将主题应用到V7支持操作栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是支持V7库来实现动作条在我app..I有这个在我的 styles.xml 文件

I am using the support v7 library to implement ActionBar in my app..I have this in my styles.xml file

<?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>

然而,Eclipse的抱怨在 actionBarStyle 行。错误是这个:

安卓actionBarStyle需要API级别11(目前最小为8)

我能做些什么,以我的主题适用于API级别8-10?

What can I do to apply my theme to API levels 8-10?

推荐答案

您需要提供两个API的具体styles.xml。在你的价值观/ styles.xml使用

You need to provide two API specific styles.xml. In your values/styles.xml use

<style name="AppTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
        <item name="actionBarStyle">@style/ActionBarTheme</item>
</style>

和你的价值观-V14 / styles.xml使用

and in your values-v14/styles.xml use

<style name="AppTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
        <item name="android:actionBarStyle">@style/ActionBarTheme</item>
</style>

这篇关于将主题应用到V7支持操作栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆