Reputation: 702
this question is already ask on stack overflow but didn't work for me.
I want to change my action bar color only like facebook app the top action is in blue color and rest of the thing has white background color.
I tried using the post in stack overflow but, it's change my full activity color to white instead of just only the action bar.
Here is my style.xml and
<style name="CustomActivityTheme" parent="@android:style/Theme.Holo">
<item name="android:actionBarTabStyle">@color/blue_base</item>
<!-- other activity and action bar styles here -->
</style>
manifest.xml
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/CustomActivityTheme">
Thanks.
Upvotes: 0
Views: 717
Reputation: 2766
Now I realized where you did wrong. You can't pass color to actionBarTabStyle
, you have to pass style. Instead you can define your style
and pass it to it like this,
<style name="MyActionBar" parent="@android:style/Widget.Holo.ActionBar">
<item name="android:background">@drawable/ab_background</item>
</style>
This example from Android Developers page, if you take a look at there they explain very well.
There is another good article also on Android Developers Blog
Upvotes: 0
Reputation: 26547
You can't use a color directly, you have to use a drawable :
action_bar_bg.xml :
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/blue_base"/>
</shape>
Then this should work :
<item name="android:actionBarTabStyle">@drawable/action_bar_bg</item>
Upvotes: 2