1

I'm using ActionBarSherlock, and want to use a custom background for both the ActionBar and the content view below it. When I try this, the background fills the whole screen, including the actionbar:

<style name="MyTheme" parent="@style/Theme.Sherlock">
    <item name="android:windowBackground">@drawable/background</item>
</style>

So, from this answer, I tried to add abBackground to the theme:

<style name="MyTheme" parent="@style/Theme.Sherlock">
    <item name="android:windowBackground">@drawable/background</item>
    <item name="abBackground">@drawable/bg_button_idle</item>
</style>

However, I get the error

Error: No resource found that matches the given name: attr 'abBackground'.

Why is this, and how can I fix it?

3 Answers 3

8

Here's how you can change the actionbar background:

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

<style name="MyActionBar" parent="Widget.Sherlock.ActionBar">
    <item name="background">@drawable/your_custom_drawable</item>
    <item name="android:background">@drawable/your_custom_drawable</item>
</style>
1
  • 2
    You need an android:background item in the action bar style as well for ICS+. Aug 3, 2012 at 17:12
0

//there is no abBackground

 <item name="abBackground">@drawable/bg_button_idle</item>

//try

<item name="android:background">@drawable/bg_button_idle</item>
2
  • 1
    Using background f*s up the whole layout, so that is not an option.
    – nhaarman
    Aug 3, 2012 at 11:42
  • If you use Benito answer it doesn't.
    – Laranjeiro
    Apr 2, 2013 at 15:49
-2

if the project is a library module you shou check the Library module enter image description here

2
  • Not sure what youre trying to say here, this surely is not an answer to the question
    – Tim
    Jan 5, 2016 at 8:58
  • sorry,I through it was your main modules can not find your library modules src。
    – Ant小波
    May 10, 2016 at 15:15

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.