ActionBar Divider Styling

actionbarsherlock, android, android-actionbar

Solution

the attribute you are looking for is:

<style name="Theme.Example" parent="Theme.Sherlock">
    <item name="actionBarDivider">@drawable/small_detail_divider</item>
    ....
    <item name="android:actionBarDivider">@drawable/small_detail_divider</item>
    ...
</style>

Just to give you some more info.

The split ActionBar should be set with:

<style name="Theme.Example" parent="Theme.Sherlock">
    <item name="actionBarSplitStyle">@style/Widget.Styled.ActionBarSplit</item>
    <item name="android:actionBarSplitStyle">@style/Widget.Styled.ActionBarSplit</item>
    ...

Then provide your custom style for the split action bar..

Thrid question: Adding in order:

When you add the menu item pragmatically use: Menu

`menu.add (0, R.id.menu_new_ab_item, 0, "Item");`

The order determines how you order your menu items.

You can be more specific in your menu.xml files `android:orderInCategory="1..n"` can be any int. I normally start at 10 or so, so I can inflate items in-front of the standard items.

Problem

I have two questions. Before detailing these questions, I want to add I'm using `ActionBarSherlock`. The first question would be that I am having issues with adding a divider between `ActionItems` in my `ActionBar`. In the printscreen, there are 3 dividers, for instance the first one is between the back button and Check In. I customized my ActionBar using the style below. However, the drawable called `small_detail_divider` does not show up. I also tried adding this divider programmatically, using the `setBackgroundSplitDrawable()`. That did not help either. What should I do to add divider between those `ActionItem`s? ``` <style name="Theme.Example" parent="Theme.Sherlock"> <item name="actionBarStyle">@style/Widget.Styled.ActionBar</item> <item name="absForceOverflow">true</item> </style> <style name="Widget.Styled.ActionBar" parent="Widget.Sherlock.ActionBar.Solid"> <item name="background">@drawable/top_panel_background</item> <item name="icon">@drawable/application_logo</item> <item name="backgroundSplit">@drawable/small_detail_divider</item> <item name="android:background">@drawable/top_panel_background</item> <item name="android:icon">@drawable/application_logo</item> <item name="android:backgroundSplit">@drawable/small_detail_divider</item> </style> ``` Another question would be: I want to add action items in the same manner as they are added within the printscreen. When I add the action items, they are always added to the right of the `ActionBar`. How can I add an action item to the left of the `ActionBar` such as the Back Button in the printscreen? Any suggestion would help.

Original source