我試圖通過修改發現的代碼here使用ActionBarSherlock在我的操作欄中實現取消/完成佈局。ActionBarSherlock - 未顯示預分頻器的分頻器
一切按ICS或Jelly Bean(其中ABS將使用本機ActionBar)的預期工作。
我起初以爲這是與分離圖像的問題,但即使在使用時:當薑餅(API 10)測試,一切都只是分隔不按鍵之間出現工作正常喜歡碼:
android:divider="#f00"
無隔離帶出現在薑餅,但鮮豔的紅色一個出現,符合市場預期,對ICS/JB。顯然,ActionBarSherlock 3.5+使用原生行爲來實現divider外觀,那麼爲什麼在使用ABS時divider不會出現,而是在使用原生ActionBar時出現?
這裏是我的XML:
actionbar_custom_view_done_discard.xml
<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>
actionbar_cancel_button.xml
<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>
actionbar_done_button.xml是完全一樣的,但上面用名稱,文字和圖標已更改。
在此先感謝。
啊,謝謝!那我就這樣做。 – Ellis 2013-03-17 20:52:10