Partition styling ActionBar

foursquare printscreen

I have two questions. Before detailing these questions, I want to add that I am using ActionBarSherlock .

The first question is that I am having problems adding a separator between ActionItems in my ActionBar . There are 3 dividers on the print screen, for example, the first is between the back button and Check .

I set up my ActionBar using the style below. However, the pushed call to small_detail_divider not displayed. I also tried to add this separator programmatically using setBackgroundSplitDrawable() . It didn’t help either. What to do to add a separator between these 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> 

One more question: I want to add action elements in the same way as they are added in the print window. When I add action items, they are always added to the right of the ActionBar . How to add an action element to the left of the ActionBar , for example, the back button on the print screen? Any suggestion will help.

+8
android actionbarsherlock android-actionbar
source share
1 answer

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 more information.

The ActionBar partition must be set using:

 <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 specify your style for the split action bar.

Thrid Question: Adding to the order:

When adding a 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 usually start with 10 or so, so I can inflate elements in front of standard elements.

+9
source share

All Articles