I know there are very few questions already posted on this thing. I filtered almost every post, but no luck and I am not getting the result which I have to get. First I tried code snippet#1, everything worked fine as in the image1. But now I must change the actionbar background to light and dull color, so did it, the result is activity's title and items' titles are in white color which are barely legible. So, decided to change the text color, but didn't get how to change it with my present code in the styles.xml. If someone could help me in changing the text color with present code(snippet#1) itself, that would be very great. As I didn't get how to modify the present code, I Followed this and so now my code is code snippet#2, now my action bar completely goes weird making the home icon and app title disappear and displays only the item that is towards right like the image 2. Can someone please help me resolve this issue?
code snippet#1
<style name="MyTheme" parent="Theme.Sherlock">
<item name="actionBarStyle">@style/MyActionBar</item>
<item name="android:actionBarStyle">@style/MyActionBar</item>
<item name="android:windowBackground">@color/white</item>
</style>
<style name="MyActionBar" parent="Widget.Sherlock.ActionBar">
<item name="background">@drawable/action_bar_background</item>
<item name="android:background">@drawable/action_bar_background</item>
</style>
code snippet#2
<style name="MyTheme" parent="Theme.Sherlock.Light">
<item name="actionBarStyle">@style/CustomActionBar</item>
</style>
<style name="CustomActionBar" parent="android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">@drawable/action_bar_background</item>
<item name="titleTextStyle">@style/ActionBarTitle</item>
</style>
<style name="ActionBarTitle" parent="@android:style/TextAppearance.Medium">
<item name="android:textColor">#000000</item>
</style>
Below are my images:
In the second image, title, icon and blue border line are disappeared. I have to show them because I am setting home enabled to true.
This is the most recommended for customizing an ActionBar:
http://jgilfelt.github.com/android-actionbarstylegenerator/
its easy too.
If you only want to change some Text color/size, try this:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="YOURTHEME" parent="Theme.Sherlock.Light">
<item name="android:actionBarStyle">@style/YOURTHEME.ActionBarStyle</item>
<item name="actionBarStyle">@style/YOURTHEME.ActionBarStyle</item>
</style>
<style name="YOURTHEME.ActionBarStyle" parent="Widget.Sherlock.Light.ActionBar">
<item name="android:titleTextStyle">@style/YOURTHEME.ActionBar.TitleTextStyle</item>
<item name="titleTextStyle">@style/YOURTHEME.ActionBar.TitleTextStyle</item>
</style>
<style name="YOURTHEME.ActionBar.TitleTextStyle" parent="TextAppearance.Sherlock.Widget.ActionBar.Title">
<item name="android:textColor">@color/YOUR_COLOR</item>
<item name="textColor">@color/YOUR_COLOR</item>
<item name="android:textSize">@dimension/MEDIUM_TEXT</item>
<item name="textSize">@dimension/MEDIUM_TEXT</item>
</style>
</resources>
I used the link above from Archie.bpgc and created a style that used the Light - Dark Action Bar and that solved my problem by allowing me to pick the colors that I needed.
The above example did not work for me to change the text color.
The link: http://jgilfelt.github.com/android-actionbarstylegenerator/
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