自定义上下文操作栏

时间:2013-08-09 22:04:24

标签: android contextual-action-bar

所以我试图找出如何更改ABS中上下文操作栏菜单项文本的颜色。

如何自定义菜单项的文本颜色和定位(即以重心为中心)?

我一直在努力尝试改变文本颜色,但是我一直在努力尝试使用xml样式,但我无法解决这个问题。

这是我试图实现的风格。 任何帮助,将不胜感激!谢谢!

enter image description here

 <style name="Theme.MyApp" parent="@style/Holo.Theme.Light.DarkActionBar">
    <item name="android:actionBarItemBackground">@drawable/selectable_background_MyApp</item>
    <item name="android:popupMenuStyle">@style/PopupMenu.MyApp</item>
    <item name="android:dropDownListViewStyle">@style/DropDownListView.MyApp</item>
    <item name="android:actionBarTabStyle">@style/ActionBarTabStyle.MyApp</item>
    <item name="android:actionDropDownStyle">@style/DropDownNav.MyApp</item>
    <item name="android:actionBarStyle">@style/ActionBar.Solid.MyApp</item>
    <item name="android:actionModeBackground">@drawable/cab_background_top_MyApp</item>
    <item name="android:actionModeSplitBackground">@drawable/cab_background_bottom_MyApp</item>
    <item name="android:actionModeCloseButtonStyle">@style/ActionButton.CloseMode.MyApp</item>
    <item name="android:actionDropDownStyle">@style/ActionBar.Solid.MyApp.NavigationDropDownStyle</item>
    <item name="android:spinnerDropDownItemStyle">@style/ActionBar.Solid.MyApp.NavigationDropDownStyle.Item</item>
    <item name="actionBarItemBackground">@drawable/selectable_background_MyApp</item>
    <item name="popupMenuStyle">@style/PopupMenu.MyApp</item>
    <item name="dropDownListViewStyle">@style/DropDownListView.MyApp</item>
    <item name="actionBarTabStyle">@style/ActionBarTabStyle.MyApp</item>
    <item name="actionDropDownStyle">@style/DropDownNav.MyApp</item>
    <item name="actionBarStyle">@style/ActionBar.Solid.MyApp</item>
    <item name="actionModeBackground">@drawable/cab_background_top_MyApp</item>
    <item name="actionModeSplitBackground">@drawable/cab_background_bottom_MyApp</item>
    <item name="android:actionModeCloseDrawable">@drawable/icon_navigation_accept</item>
    <item name="actionModeCloseDrawable">@drawable/icon_navigation_accept</item>
    <item name="textColorPrimary">#FFFFFF</item>
    <item name="actionDropDownStyle">@style/ActionBar.Solid.MyApp.NavigationDropDownStyle</item>
    <item name="spinnerDropDownItemStyle">@style/ActionBar.Solid.MyApp.NavigationDropDownStyle.Item</item>
    <item name="titleTextStyle">@style/ActionMode.MyApp.TextStyle</item>
    <item name="actionModeCloseButtonStyle">@style/MyApp.ActionModeCloseButton</item>
    <item name="actionMenuTextAppearance">@style/ActionMode.MyApp.TextStyle</item>
</style>

<style name="MyApp.ActionModeCloseButton" parent="@android:style/Widget.DeviceDefault.ActionButton.CloseMode">
    <item name="android:textColor">#000000</item>
    <item name="android:text">Done</item>
    <item name="android:visibility">invisible</item>
</style>

 <style name="ActionMode.MyApp.TextStyle" parent="Widget">
    <item name="actionMenuTextColor">#000000</item>
</style>

<style name="ActionBar.Solid.MyApp" parent="style/Widget.Sherlock.ActionBar.Solid">
    <item name="android:background">@drawable/ab_solid_MyApp</item>
    <item name="android:backgroundStacked">@drawable/ab_stacked_solid_MyApp</item>
    <item name="android:backgroundSplit">@drawable/ab_bottom_solid_MyApp</item>
    <item name="android:progressBarStyle">@style/ProgressBar.MyApp</item>
    <item name="android:titleTextStyle">@style/ActionBar.Solid.MyApp.TitleTextStyle</item>

    <item name="background">@drawable/ab_solid_MyApp</item>
    <item name="backgroundStacked">@drawable/ab_stacked_solid_MyApp</item>
    <item name="backgroundSplit">@drawable/ab_bottom_solid_MyApp</item>
    <item name="progressBarStyle">@style/ProgressBar.MyApp</item>
    <item name="titleTextStyle">@style/ActionBar.Solid.MyApp.TitleTextStyle</item>

    <item name="divider">?attr/dividerVertical</item>
    <item name="itemPadding">8dip</item>
</style>

1 个答案:

答案 0 :(得分:0)

Roman Nurik已经做到了这一点:https://plus.google.com/+RomanNurik/posts/R49wVvcDoEW 它不是一个上下文操作栏,它只是一个自定义视图。

Done | Discard