문제

I'm trying to change color of the action bar across the board in my app. I found this answer which suggests a way to do it. So I've created a themes.xml file under res/values folder with the following:

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

However, I get an error in the above code:

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

in my build.gradle I have the following:

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

I am using AndroidStudio and Gradle

도움이 되었습니까?

해결책

ActionBarSherlock version 4.4 does not include the ForceOverflow themes, it was removed in 4.2. You will need to use an older version of ABS to use ForceOverflow as a theme.

As per the Change Log :

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

If you don't actually need the ForceOverflow, you could use Theme.Sherlock, see the official page for details :

<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>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top