sarath
sarath

Reputation: 3201

Actionbar sherlock light theme

Now I am working on a android app using actionbar sherlock and fragment.I used the following theme.

<style name="Theme.AndroidDevelopers" parent="Theme.Sherlock.ForceOverflow">
    <item name="android:actionDropDownStyle">@style/MyDropDownNav</item>
    <item name="actionDropDownStyle">@style/MyDropDownNav</item>

    </style>

And I got the following Output.enter image description here

But I want use the light theme so I changed the parent as

parent="Theme.Sherlock.Light.ForceOverflow"

Then I got the following outputenter image description here

The light theme is missing the blue underline. How can i make that blue underline?...Please help me friends.

Upvotes: 2

Views: 6076

Answers (2)

Ahmad
Ahmad

Reputation: 72583

You have to create you own theme in order to do that:

<resources>
  <style name="MyTheme" parent="@android:style/Theme.Holo.Light">
    <item name="android:actionBarStyle">@style/MyActionBar</item>
  </style>

  <style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
    <item name="android:background">ANY_HEX_COLOR_CODE</item>
  </style>
</resources>

As the Background you can then put a modified 9 patch Image with a blue underline. Look at your Android Sdk > API 13+ there should be the original Actionbar bavkground drawables. Just modify them and set it as background. Don't forget to set this Theme as your App theme later on.

Edit:

Here are some 9 Patch images from Jake Whartons Action Bar Sherlock(what a coincidence that he formated my post earlier...:) ):

blue Stroke grey background

Upvotes: 5

StenaviN
StenaviN

Reputation: 3697

Create your own style for action bar and override background property:

<style name="MyActionBarStyle" parent="Widget.Sherlock.Light.ActionBar.Solid">
    <item name="android:background">@drawable/bg_action_bar</item>
    <item name="background">@drawable/bg_action_bar</item>
</style>

Use this style for your action bar in theme:

<style name="Theme.AndroidDevelopers" parent="Theme.Sherlock.Light.ForceOverflow">
    <item name="actionBarStyle">@style/MyActionBarStyle</item>
    <item name="android:actionBarStyle">@style/MyActionBarStyle</item>
</style>

Take a look onto res\drawable-hdpi\abs__ab_transparent_light_holo.9.png drawable inside ActionBarSherlock sources how to create 9-patch drawable with color strip line at the bottom.

Upvotes: 2

Related Questions