Search...

Sunday, November 13, 2011

How to change the background of actionbar in android


Step1: create three background image for action bar

Step2: create new style element in style.xml

<style name="actionBar" parent="android:style/Widget.Holo.ActionBar">
<item name="android:background">@drawable/bar_top_blue</item>
</style>

Step3: create new style element in style.xml to set “actionBar” style.

    <style name="CustomActionBar" parent="android:style/Theme.Holo">

<item name="android:actionBarStyle">@style/actionBar</item>

</style>
Step4: Use style element created in step3 in your activity attribute of AndroidManifest.xml

<activity android:name=".base.activity.MyActivity"
android:screenOrientation="sensorLandscape" android:theme="@style/CustomActionBar">



</activity>

2 comments:

  1. I don't understand...
    Where i'll put the hex color code?

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete