I'm using ActionBarSherlock to make my app compatible with older devices. The implementation was easy, but now i need to style the default Holo blue line that you see under the tabs to a red line.
I've been reading a few topics (topic 1, topic 2) here on SO and also the ABS doc (link), but i can't get it to work.
This is what i have so far.
In my AndroidManifest.xml i added this line to the application
tag.
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.Sherlock" > <!-- SET THE DEFAULT THEME -->
Then in res/values/styles.xml
i have:
<resources>
<style name="AppTheme" parent="android:Theme.Light" />
<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>
<style name="Widget.MyTheme.ActionBar" parent="Widget.Sherlock.ActionBar">
<item name="android:background">#ff000000</item>
<item name="background">#ff000000</item>
</style>
</resources>
But when i run my app, then i still see the default blue line color.
What am i doing wrong?
EDIT
Read this if you want to fully style your ActionBarSherlock!
I found an answer here on SO which gave the following link: http://jgilfelt.github.com/android-actionbarstylegenerator
It's an easy generator which generates all the needed files for a fully customized ABS! All you have to do is copy the generated files into the appropiate folders and you're set!
Don't forget to enable the style (you'll have to enter a style name in the generator) in your AndroidManifest. For that, see the answer below.
A few things:
You don't really need <style name="AppTheme" parent="android:Theme.Light" />
anymore unless you want to change it to inherit Theme.Sherlock
and use it for your app theme. If you decide to do this you will have to use Theme.MyTheme
for activities.
Either way, to fix the problem you want to change
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.Sherlock" >
to
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.MyTheme" >
OR you can apply the theme directly to your activities:
<activity
android:name="com.awesome.package.activity.SomeActivity"
android:theme="@style/Theme.MyTheme"/>
Side note, I recommend this excellent actionbar theme generator
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With