gpt4 book ai didi

android - 如何使用 actionbarsherlock 更改操作栏的颜色

转载 作者:行者123 更新时间:2023-11-29 01:44:59 25 4
gpt4 key购买 nike

我正在尝试在我的应用程序中全面更改操作栏的颜色。我找到了 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>

但是,我在上面的代码中得到一个错误:

Error retrieving parent for item: No resource found that matches the given name 'Theme.Sherlock.ForceOverFlow'.

在我的 build.gradle 中我有以下内容:

compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'

我正在使用 AndroidStudio 和 Gradle

最佳答案

ActionBarSherlock 4.4 版不包含 ForceOverflow 主题,它在 4.2 中被删除。您将需要使用旧版本的 ABS 才能将 ForceOverflow 用作主题。

根据 Change Log :

Fix: Remove .ForceOverflow themes. These never should have been included.

如果您实际上不需要 ForceOverflow,您可以使用 Theme.Sherlock,参见 the official page详情:

<style name="Theme.MyTheme" parent="Theme.Sherlock">
<item name="actionBarStyle">@style/Widget.MyTheme.ActionBar</item>
<item name="android:actionBarStyle">@style/Widget.MyTheme.ActionBar</item>
</style>

关于android - 如何使用 actionbarsherlock 更改操作栏的颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22021148/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com