我想自定义我的应用程序并且我已经应用了一个主题,但选项菜单似乎没有应用我的主题。
我希望我的文本颜色为白色,背景为黑色,突出显示/选定的菜单项为黄色。这是我的主题.xml:
<style name="CustomActionBarTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
<item name="android:actionBarStyle">@style/MyActionBar</item>
<item name="android:actionBarTabTextStyle">@style/MyActionBarTabText</item>
<item name="android:actionMenuTextColor">@color/application_color5</item>
<item name="android:actionBarTabStyle">@style/MyActionBarTabs</item>
<item name="android:selectableItemBackground">@drawable/icone_barratopo_selector</item>
<item name="android:actionBarItemBackground">@drawable/icone_barratopo_selector</item>
<item name="android:selectableItemBackground">@drawable/icone_barratopo_selector</item>
<!-- Panel attributes -->
<!-- <item name="android:panelBackground">@drawable/selectable_background</item> --
<!-- Support library compatibility -->
<item name="actionBarStyle">@style/MyActionBar</item>
<item name="actionBarTabTextStyle">@style/MyActionBarTabText</item>
<item name="actionMenuTextColor">@color/application_color5</item>
<item name="actionBarTabStyle">@style/MyActionBarTabs</item>
<item name="selectableItemBackground">@drawable/icone_barratopo_selector</item>
<item name="actionBarItemBackground">@drawable/icone_barratopo_selector</item>
<item name="selectableItemBackground">@drawable/icone_barratopo_selector</item>
</style>
<!-- ActionBar styles -->
<style name="MyActionBar" parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="android:background">@drawable/background_barratopo_superior</item>
<item name="android:titleTextStyle">@style/MyActionBarTitleText</item>
<!-- Support library compatibility -->
<item name="background">@drawable/background_barratopo_superior</item>
<item name="titleTextStyle">@style/MyActionBarTitleText</item>
</style>
<!-- ActionBar title text -->
<style name="MyActionBarTitleText" parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">@color/application_color2</item>
</style>
<!-- ActionBar tabs text -->
<style name="MyActionBarTabText" parent="@style/Widget.AppCompat.ActionBar.TabText">
<item name="android:textColor">@drawable/tab_text_selector</item>
</style>
<!-- ActionBar tabs styles -->
<style name="MyActionBarTabs" parent="@style/Widget.AppCompat.ActionBar.TabView">
<!-- tab indicator -->
<item name="android:background">@drawable/actionbar_tab_indicator</item>
<!-- Support library compatibility -->
<item name="background">@drawable/actionbar_tab_indicator</item>
</style>
我的 menu.xml:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:motobox="http://schemas.android.com/apk/res-auto" >
<!--
<item
android:id="@+id/option_availability"
android:icon="@drawable/icone_barratopo_mymotobox"
android:orderInCategory="100"
motobox:showAsAction="always"/>
-->
<item
android:id="@+id/option_refresh"
android:icon="@drawable/icone_barratopo_back"
android:orderInCategory="100"
motobox:showAsAction="always"/>
<item
android:id="@+id/status"
android:orderInCategory="100"
android:title="Indisponível"
motobox:showAsAction="never"/>
<item
android:id="@+id/logout"
android:orderInCategory="100"
android:title="Logout"
motobox:showAsAction="never"/>
和我的 selector.xml:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/application_color3" android:state_focused="false" android:state_pressed="false" android:state_selected="false"/>
<!-- Pressed -->
<item android:drawable="@color/application_color2" android:state_pressed="true"/>
<!-- Focused -->
<item android:drawable="@color/application_color2" android:state_focused="true" android:state_pressed="false" android:state_selected="false"/>