Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Add a style to the actionbar on one activity

I want to add a style from styles.xml

<style name="BlueActionBar" parent="@android:style/Widget.Holo.ActionBar">
    <item name="android:background">@color/blue</item>
    <item name="android:textColor">#FFFFFF</item>
</style>

to my Actionbar but just on the Activity BlueActivity (which is still blank). How to do that? I'm stuck :'(

edit: Why does adding

android:actionBarStyle="@style/BlueActionBar"

to BlueActivity in the Manifest not work?

like image 738
Jonas Avatar asked Mar 21 '13 19:03

Jonas


1 Answers

themes.xml:

<style name="Theme.Project.Activity1" parent="Theme.Sherlock.Light.DarkActionBar">
    <item name="actionBarStyle">@style/Widget.Project.Activity1.ActionBar</item>
    <item name="android:actionBarStyle">@style/Widget.Project.Activity1.ActionBar</item>
</style>

AndroidManifest.xml:

<activity android:name="com.example.Activity1"
          android:theme="@style/Theme.Project.Activity1"
/>
like image 97
agamov Avatar answered Nov 26 '22 12:11

agamov