I'm using the sherlok-actionbar and trying to apply a divider between the action buttons.
I have th style but the dividers are not visible, why?
<style name="Theme.SherlockCustom" parent="@style/Theme.Sherlock.Light">
<item name="abBackground">@drawable/actionbar_gradient</item>
<item name="abIcon">@drawable/logo</item>
<item name="abDivider">@drawable/ab_divider</item>
</style>
Thanks!
ActionBarSherlock v3.5 was updated to include the sources from Ice Cream Sandwich for all action-item related views and classes. This means that the rules for placing a divider between two action items follows the same rules as it would on ICS.
A divider would only be shown between the following:
- Text-only followed by text-only
- Icon-only followed by text-only
- Text and icon followed by text-only
If you want to override this behavior (on pre-3.0 only) make the following change to ActionItemView.java
:
What you can do is to add a view next to the actionbar item that will look like the separator (works on all Android versions)
<item
android:actionViewClass="com.example.ActionSeparatorView"
android:showAsAction="always"
android:title="@null"/>
and the ActionSeparatorView is a simple extension of the ImageView with the drawable you want to show as a separator
public class ActionSeparatorView extends ImageView {
public ActionSeparatorView (Context context) {
super(context);
setImageDrawable(getResources().getDrawable(R.drawable.separator));
}
}