Android ActionBarSherlock-未显示预集成电路的分隔器

Android ActionBarSherlock-未显示预集成电路的分隔器,android,xml,android-layout,android-actionbar,actionbarsherlock,Android,Xml,Android Layout,Android Actionbar,Actionbarsherlock,我正试图通过修改找到的代码,使用ActionBarSherlock在我的操作栏中实现取消/完成布局 在ABS将使用本机ActionBar的ICS或Jelly Bean上,一切都按预期运行。在姜饼API 10上进行测试时,除了按钮之间没有出现分隔符外,其他一切正常: 起初我认为这是分割图像的问题,但即使使用如下代码: android:divider="#f00" 姜饼上没有显示分隔符,但ICS/JB上出现了一个亮红色分隔符。显然,ActionBarSherlock 3.5+将本机行为用于分隔器外

我正试图通过修改找到的代码,使用ActionBarSherlock在我的操作栏中实现取消/完成布局

在ABS将使用本机ActionBar的ICS或Jelly Bean上,一切都按预期运行。在姜饼API 10上进行测试时,除了按钮之间没有出现分隔符外,其他一切正常:

起初我认为这是分割图像的问题,但即使使用如下代码:

android:divider="#f00"
姜饼上没有显示分隔符,但ICS/JB上出现了一个亮红色分隔符。显然,ActionBarSherlock 3.5+将本机行为用于分隔器外观,那么为什么在使用ABS时分隔器不出现,而在使用本机ActionBar时出现

以下是我的XML:

actionbar_custom_view_done_discard.xml

actionbar\u cancel\u button.xml

actionbar_done_button.xml与上述内容完全相同,但名称、文本和图标已更改

提前感谢。

线性布局中的分隔符是API 11+。这与ActionBarSherlock无关


您只需在两个元素之间添加一个背景的1dp视图即可解决此问题。

这是我发现的自定义ActionBar布局的最佳实现:


啊,谢谢!谢谢分享,这比我的观点更清晰。可能会像我一样发布整个LinearLayout,以便人们可以复制和粘贴它实际上来自answer,它使用layout-v11文件夹中的本机实现和layout文件夹中的自定义实现。它起作用了,但我觉得这是不必要的重复。我将编辑答案以包含整个布局。我的问题中描述了按钮的布局。您能否发布其中一个actionbar按钮的布局代码?谢谢
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:divider="?attr/dividerVertical"
    android:dividerPadding="12dp"
    android:orientation="horizontal"
    android:showDividers="middle" >

    <include layout="@layout/actionbar_cancel_button" />

    <include layout="@layout/actionbar_done_button" />

</LinearLayout>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/actionbar_cancel"
    style="?actionButtonStyle"
    android:layout_width="0dp"
    android:layout_height="match_parent"
    android:layout_weight="1"
    android:background="@drawable/abs__item_background_holo_light" >

    <TextView
        style="?actionBarTabTextStyle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:drawableLeft="@drawable/ic_action_cancel"
        android:drawablePadding="8dp"
        android:gravity="center_vertical"
        android:paddingRight="20dp"
        android:text="@string/action_cancel" />

</FrameLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >

<include layout="@layout/actionbar_cancel_button" />

<!-- View below is used because the android:divider attribute only works on API 11+. This is identical in appearance to that. -->

<View
    style="@style/Widget.Sherlock.Light.ActionButton"
    android:layout_width="1dp"
    android:layout_height="match_parent"
    android:layout_marginBottom="12dp"
    android:layout_marginTop="12dp"
    android:background="@drawable/abs__list_divider_holo_light" />

<include layout="@layout/actionbar_done_button" />