【发布时间】:2014-02-25 17:03:12
【问题描述】:
我正在尝试在我的应用中全面更改操作栏的颜色。我找到了this answer,它提出了一种方法。所以我在res/values 文件夹下创建了一个themes.xml 文件,内容如下:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.MyTheme" parent="Theme.Sherlock.ForceOverFlow">
<item name="actionBarStyle">@style/Widget.MyTheme.ActionBar</item>
<item name="android:actionBarStyle">@style/Widget.MyTheme.ActionBar</item>
</style>
<style name="Widget.MyTheme.ActionBar" parent="Widget.Sherlock.ActionBar">
<item name="android:background">#fff4231e</item>
<item name="background">#fff4231e</item>
</style>
</resources>
但是,我在上面的代码中得到一个错误:
检索项目的父项时出错:未找到与 给定名称“Theme.Sherlock.ForceOverFlow”。
在我的 build.gradle 我有以下内容:
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
我正在使用 AndroidStudio 和 Gradle
【问题讨论】:
-
如果您使用的是 Eclipse,我有时会在编辑 style.xml 文件时遇到奇怪的解析错误。您是否尝试过打开“问题”窗口、删除错误消息并尝试重建项目? -- 另外,如果您使用的是 4.2.0 或更高版本,那么显然它已被删除:stackoverflow.com/a/13180285/1426565
标签: android actionbarsherlock android-theme