如何更改 ActionBar 菜单背景颜色 (android 4 & 5)
How to change ActionBar menu background color (android 4 & 5)
我在更改 android 设计时遇到了一个麻烦。我需要将操作栏菜单背景颜色更改为黑色。我知道,这个问题有很多答案。我试过很多。但对我没有任何帮助。
哦,我忘了说,我不是一个非常熟练的 android 开发人员。这是我的样式文件 (v21)
<?xml version="1.0" encoding="utf-8"?>
<style name="AppTheme" parent="@style/Theme.AppCompat.Light">
<item name="colorPrimary">@color/mainColor</item>
<item name="colorPrimaryDark">@color/secondaryColor</item>
<item name="colorAccent">@color/goldColor</item>
<item name="colorControlNormal">@color/mainColor</item>
<item name="colorControlActivated">@color/secondaryColor</item>
<item name="colorControlHighlight">@color/secondaryColor</item>
<item name="android:navigationBarColor">@color/blackColor</item>
<item name="colorSwitchThumbNormal">@color/secondaryTextColor</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:textColorPrimary">@color/goldColor</item>
<item name="android:windowBackground">@color/blackColor</item>
<item name="android:itemTextAppearance">@color/normalTextColor</item>
<item name="android:buttonStyle">@style/ButtonStyle</item>
<item name="android:actionMenuTextColor">@color/blackColor</item>
<item name="actionMenuTextColor">@color/blackColor</item>
<item name="android:actionBarPopupTheme">@style/Theme.Red.Widget</item>
<item name="android:popupTheme">@color/blackColor</item>
</style>
<style name="Theme.Red.Widget" parent="@style/Theme.AppCompat">
<item name="popupMenuStyle">@style/PopupMenu.Red</item>
<item name="dropDownListViewStyle">@style/DropDownListView.Red</item>
</style>
<style name="PopupMenu.Red" parent="@style/Widget.AppCompat.PopupMenu">
<item name="android:popupBackground">@color/blackColor</item>
</style>
<style name="DropDownListView.Red" parent="@style/Widget.AppCompat.ListView.DropDown">
<item name="android:listSelector">@color/blackColor</item>
</style>
<color name="mainColor">#373737</color>
<color name="secondaryColor">#252525</color>
<color name="goldColor">#cea939</color>
<style name="Divider">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">1dp</item>
<item name="android:background">?android:attr/listDivider</item>
</style>
<style name="ButtonStyle" parent="android:Widget.Button">
<item name="android:background">@drawable/custom_btn</item>
</style>
这是我的 android 低版本代码。
<resources>
<style name="AppTheme" parent="@style/Theme.AppCompat.Light">
<item name="colorPrimary">@color/mainColor</item>
<item name="colorPrimaryDark">#856f2d</item>
<item name="colorAccent">@color/mainColor</item>
<item name="colorControlNormal">@color/mainColor</item>
<item name="colorControlActivated">#856f2d</item>
<item name="colorControlHighlight">#856f2d</item>
<item name="colorSwitchThumbNormal">@color/mainColor</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:textColorPrimary">@color/blackColor</item>
<item name="android:textColorSecondary">@color/blackColor</item>
<item name="android:textColorTertiary">@color/blackColor</item>
<item name="android:windowBackground">@color/backgroundColor</item>
<item name="android:itemTextAppearance">@color/normalTextColor</item>
<item name="android:editTextBackground">@drawable/apptheme_edit_text_holo_light</item>
<item name="android:textColorHighlight">#99cea939</item>
<item name="android:textSelectHandleLeft">@drawable/apptheme_text_select_handle_left</item>
<item name="android:textSelectHandleRight">@drawable/apptheme_text_select_handle_right</item>
<item name="android:textSelectHandle">@drawable/apptheme_text_select_handle_middle</item>
<item name="android:autoCompleteTextViewStyle">@style/AutoCompleteTextViewAppTheme</item>
<item name="android:listChoiceIndicatorMultiple">@drawable/apptheme_btn_check_holo_light</item>
<item name="android:listChoiceIndicatorSingle">@drawable/apptheme_btn_radio_holo_light</item>
<item name="android:buttonStyle">@style/ButtonAppTheme</item>
<item name="android:imageButtonStyle">@style/ImageButtonAppTheme</item>
<item name="android:dropDownSpinnerStyle">@style/SpinnerAppTheme</item>
<item name="android:progressBarStyleHorizontal">@style/ProgressBarAppTheme</item>
<item name="android:seekBarStyle">@style/SeekBarAppTheme</item>
<item name="android:ratingBarStyle">@style/RatingBarAppTheme</item>
<item name="android:ratingBarStyleIndicator">@style/RatingBarBigAppTheme</item>
<item name="android:ratingBarStyleSmall">@style/RatingBarSmallAppTheme</item>
<item name="android:buttonStyleToggle">@style/ToggleAppTheme</item>
<item name="android:listChoiceBackgroundIndicator">@drawable/apptheme_list_selector_holo_light</item>
<item name="android:activatedBackgroundIndicator">@drawable/apptheme_activated_background_holo_light</item>
<item name="android:fastScrollThumbDrawable">@drawable/apptheme_fastscroll_thumb_holo</item>
</style>
<style name="SettingsToolbarTheme" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
<item name="android:textColorPrimary">@color/goldColor</item>
<item name="actionMenuTextColor">@color/abc_primary_text_material_light</item>
<item name="android:textColorSecondary">@color/goldColor</item>
</style>
<style name="Divider">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">1dp</item>
<item name="android:background">?android:attr/listDivider</item>
</style>
<style name="AutoCompleteTextViewAppTheme" parent="android:Widget.Holo.Light.AutoCompleteTextView">
<item name="android:dropDownSelector">@drawable/apptheme_list_selector_holo_light</item>
<item name="android:background">@drawable/apptheme_edit_text_holo_light</item>
</style>
<style name="ButtonAppTheme" parent="android:Widget.Holo.Light.Button">
<item name="android:background">@drawable/apptheme_btn_default_holo_light</item>
</style>
<style name="ImageButtonAppTheme" parent="android:Widget.Holo.Light.ImageButton">
<item name="android:background">@drawable/apptheme_btn_default_holo_light</item>
</style>
<style name="SpinnerAppTheme" parent="android:Widget.Holo.Light.Spinner">
<item name="android:background">@drawable/apptheme_spinner_background_holo_light</item>
<item name="android:dropDownSelector">@drawable/apptheme_list_selector_holo_light</item>
</style>
<style name="TabAppTheme">
<item name="android:gravity">center_horizontal</item>
<item name="android:paddingLeft">16dip</item>
<item name="android:paddingRight">16dip</item>
<item name="android:background">@drawable/apptheme_tab_indicator_holo</item>
<item name="android:layout_width">0dip</item>
<item name="android:layout_weight">1</item>
<item name="android:minWidth">80dip</item>
</style>
<style name="TabTextAppTheme">
<item name="android:textColor">#000000</item>
<item name="android:textSize">12sp</item>
<item name="android:textStyle">bold</item>
<!-- v14 <item name="android:textAllCaps">true</item> -->
<item name="android:ellipsize">marquee</item>
<item name="android:maxLines">2</item>
<item name="android:maxWidth">180dip</item>
</style>
<style name="ProgressBarAppTheme" parent="android:Widget.Holo.Light.ProgressBar.Horizontal">
<item name="android:progressDrawable">@drawable/apptheme_progress_horizontal_holo_light</item>
<item name="android:indeterminateDrawable">@drawable/apptheme_progress_indeterminate_horizontal_holo_light</item>
</style>
<style name="SeekBarAppTheme" parent="android:Widget.Holo.Light.SeekBar">
<item name="android:progressDrawable">@drawable/apptheme_scrubber_progress_horizontal_holo_light</item>
<item name="android:indeterminateDrawable">@drawable/apptheme_scrubber_progress_horizontal_holo_light</item>
<item name="android:thumb">@drawable/apptheme_scrubber_control_selector_holo_light</item>
</style>
<style name="RatingBarAppTheme" parent="android:Widget.Holo.Light.RatingBar">
<item name="android:progressDrawable">@drawable/apptheme_ratingbar_full_holo_light</item>
<item name="android:indeterminateDrawable">@drawable/apptheme_ratingbar_full_holo_light</item>
</style>
<style name="RatingBarBigAppTheme" parent="android:Widget.Holo.Light.RatingBar.Indicator">
<item name="android:progressDrawable">@drawable/apptheme_ratingbar_holo_light</item>
<item name="android:indeterminateDrawable">@drawable/apptheme_ratingbar_holo_light</item>
</style>
<style name="RatingBarSmallAppTheme" parent="android:Widget.Holo.Light.RatingBar.Small">
<item name="android:progressDrawable">@drawable/apptheme_ratingbar_small_holo_light</item>
<item name="android:indeterminateDrawable">@drawable/apptheme_ratingbar_small_holo_light</item>
</style>
<style name="ToggleAppTheme" parent="android:Widget.Holo.Light.Button.Toggle">
<item name="android:background">@drawable/apptheme_btn_toggle_holo_light</item>
</style>
非常感谢您的帮助。
将 actionOverflowMenuStyle 项添加到您的应用主题中
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="actionOverflowMenuStyle">@style/CMOptionsMenu</item>
</style>
<style name="CMOptionsMenu" parent="Widget.AppCompat.PopupMenu.Overflow">
<item name="android:popupBackground">your color code</item>
</style>
您可以像这样简单地添加行:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- To change the background of options menu-->
<item name="android:itemBackground">*Your_color*</item>
</style>
菜单/下拉菜单/微调器的背景颜色
几个选项之一:
编辑styles.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:popupMenuStyle">@style/PopupMenu</item>
<item name="android:popupBackground">#272727</item>
<item name="android:itemBackground">#cc9d3e</item>
</style>
在 res/menu/ 下创建 popup_menu.xml
,如下所示:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="32dp"
android:tint="@color/timeSettings"
app:popupTheme="@style/PopupMenu">
<item
android:id="@+id/min0"
android:orderInCategory="100"
android:title="0"
app:showAsAction="never" />
</menu>
编辑 java-file
中的 popupMenu:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_clock);
//Time
secBtn = (Button) findViewById(R.id.btn_sec);
secBtn.setText("00");
//levelBtn.setTypeface(tf1);
secBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
PopupMenu popupMenu = new PopupMenu(MainActivityClock.this, secBtn);
popupMenu.getMenuInflater().inflate(R.menu.popup_menu_sec, popupMenu.getMenu());
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
//Toast.makeText(MainActivity.this, "" + item.getTitle(), Toast.LENGTH_SHORT).show();
secBtn.setText("" + item.getTitle());
workTime_sec = Integer.parseInt(item.getTitle().toString());
//sec = item.getTitle().toString();
System.out.println("workTime_sec: " + workTime_sec);
return true;
}
});
popupMenu.show();
}
});
}
Rakesh Kalashetti 的回答对我做了一个小改动 - actionOverflowMenuStyle
必须以 android:
命名空间为前缀,即:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:actionOverflowMenuStyle">@style/CMOptionsMenu</item>
</style>
<style name="CMOptionsMenu" parent="Widget.AppCompat.PopupMenu.Overflow">
<item name="android:popupBackground">your color code</item>
</style>
我在更改 android 设计时遇到了一个麻烦。我需要将操作栏菜单背景颜色更改为黑色。我知道,这个问题有很多答案。我试过很多。但对我没有任何帮助。
哦,我忘了说,我不是一个非常熟练的 android 开发人员。这是我的样式文件 (v21)
<?xml version="1.0" encoding="utf-8"?>
<style name="AppTheme" parent="@style/Theme.AppCompat.Light">
<item name="colorPrimary">@color/mainColor</item>
<item name="colorPrimaryDark">@color/secondaryColor</item>
<item name="colorAccent">@color/goldColor</item>
<item name="colorControlNormal">@color/mainColor</item>
<item name="colorControlActivated">@color/secondaryColor</item>
<item name="colorControlHighlight">@color/secondaryColor</item>
<item name="android:navigationBarColor">@color/blackColor</item>
<item name="colorSwitchThumbNormal">@color/secondaryTextColor</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:textColorPrimary">@color/goldColor</item>
<item name="android:windowBackground">@color/blackColor</item>
<item name="android:itemTextAppearance">@color/normalTextColor</item>
<item name="android:buttonStyle">@style/ButtonStyle</item>
<item name="android:actionMenuTextColor">@color/blackColor</item>
<item name="actionMenuTextColor">@color/blackColor</item>
<item name="android:actionBarPopupTheme">@style/Theme.Red.Widget</item>
<item name="android:popupTheme">@color/blackColor</item>
</style>
<style name="Theme.Red.Widget" parent="@style/Theme.AppCompat">
<item name="popupMenuStyle">@style/PopupMenu.Red</item>
<item name="dropDownListViewStyle">@style/DropDownListView.Red</item>
</style>
<style name="PopupMenu.Red" parent="@style/Widget.AppCompat.PopupMenu">
<item name="android:popupBackground">@color/blackColor</item>
</style>
<style name="DropDownListView.Red" parent="@style/Widget.AppCompat.ListView.DropDown">
<item name="android:listSelector">@color/blackColor</item>
</style>
<color name="mainColor">#373737</color>
<color name="secondaryColor">#252525</color>
<color name="goldColor">#cea939</color>
<style name="Divider">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">1dp</item>
<item name="android:background">?android:attr/listDivider</item>
</style>
<style name="ButtonStyle" parent="android:Widget.Button">
<item name="android:background">@drawable/custom_btn</item>
</style>
这是我的 android 低版本代码。
<resources>
<style name="AppTheme" parent="@style/Theme.AppCompat.Light">
<item name="colorPrimary">@color/mainColor</item>
<item name="colorPrimaryDark">#856f2d</item>
<item name="colorAccent">@color/mainColor</item>
<item name="colorControlNormal">@color/mainColor</item>
<item name="colorControlActivated">#856f2d</item>
<item name="colorControlHighlight">#856f2d</item>
<item name="colorSwitchThumbNormal">@color/mainColor</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:textColorPrimary">@color/blackColor</item>
<item name="android:textColorSecondary">@color/blackColor</item>
<item name="android:textColorTertiary">@color/blackColor</item>
<item name="android:windowBackground">@color/backgroundColor</item>
<item name="android:itemTextAppearance">@color/normalTextColor</item>
<item name="android:editTextBackground">@drawable/apptheme_edit_text_holo_light</item>
<item name="android:textColorHighlight">#99cea939</item>
<item name="android:textSelectHandleLeft">@drawable/apptheme_text_select_handle_left</item>
<item name="android:textSelectHandleRight">@drawable/apptheme_text_select_handle_right</item>
<item name="android:textSelectHandle">@drawable/apptheme_text_select_handle_middle</item>
<item name="android:autoCompleteTextViewStyle">@style/AutoCompleteTextViewAppTheme</item>
<item name="android:listChoiceIndicatorMultiple">@drawable/apptheme_btn_check_holo_light</item>
<item name="android:listChoiceIndicatorSingle">@drawable/apptheme_btn_radio_holo_light</item>
<item name="android:buttonStyle">@style/ButtonAppTheme</item>
<item name="android:imageButtonStyle">@style/ImageButtonAppTheme</item>
<item name="android:dropDownSpinnerStyle">@style/SpinnerAppTheme</item>
<item name="android:progressBarStyleHorizontal">@style/ProgressBarAppTheme</item>
<item name="android:seekBarStyle">@style/SeekBarAppTheme</item>
<item name="android:ratingBarStyle">@style/RatingBarAppTheme</item>
<item name="android:ratingBarStyleIndicator">@style/RatingBarBigAppTheme</item>
<item name="android:ratingBarStyleSmall">@style/RatingBarSmallAppTheme</item>
<item name="android:buttonStyleToggle">@style/ToggleAppTheme</item>
<item name="android:listChoiceBackgroundIndicator">@drawable/apptheme_list_selector_holo_light</item>
<item name="android:activatedBackgroundIndicator">@drawable/apptheme_activated_background_holo_light</item>
<item name="android:fastScrollThumbDrawable">@drawable/apptheme_fastscroll_thumb_holo</item>
</style>
<style name="SettingsToolbarTheme" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
<item name="android:textColorPrimary">@color/goldColor</item>
<item name="actionMenuTextColor">@color/abc_primary_text_material_light</item>
<item name="android:textColorSecondary">@color/goldColor</item>
</style>
<style name="Divider">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">1dp</item>
<item name="android:background">?android:attr/listDivider</item>
</style>
<style name="AutoCompleteTextViewAppTheme" parent="android:Widget.Holo.Light.AutoCompleteTextView">
<item name="android:dropDownSelector">@drawable/apptheme_list_selector_holo_light</item>
<item name="android:background">@drawable/apptheme_edit_text_holo_light</item>
</style>
<style name="ButtonAppTheme" parent="android:Widget.Holo.Light.Button">
<item name="android:background">@drawable/apptheme_btn_default_holo_light</item>
</style>
<style name="ImageButtonAppTheme" parent="android:Widget.Holo.Light.ImageButton">
<item name="android:background">@drawable/apptheme_btn_default_holo_light</item>
</style>
<style name="SpinnerAppTheme" parent="android:Widget.Holo.Light.Spinner">
<item name="android:background">@drawable/apptheme_spinner_background_holo_light</item>
<item name="android:dropDownSelector">@drawable/apptheme_list_selector_holo_light</item>
</style>
<style name="TabAppTheme">
<item name="android:gravity">center_horizontal</item>
<item name="android:paddingLeft">16dip</item>
<item name="android:paddingRight">16dip</item>
<item name="android:background">@drawable/apptheme_tab_indicator_holo</item>
<item name="android:layout_width">0dip</item>
<item name="android:layout_weight">1</item>
<item name="android:minWidth">80dip</item>
</style>
<style name="TabTextAppTheme">
<item name="android:textColor">#000000</item>
<item name="android:textSize">12sp</item>
<item name="android:textStyle">bold</item>
<!-- v14 <item name="android:textAllCaps">true</item> -->
<item name="android:ellipsize">marquee</item>
<item name="android:maxLines">2</item>
<item name="android:maxWidth">180dip</item>
</style>
<style name="ProgressBarAppTheme" parent="android:Widget.Holo.Light.ProgressBar.Horizontal">
<item name="android:progressDrawable">@drawable/apptheme_progress_horizontal_holo_light</item>
<item name="android:indeterminateDrawable">@drawable/apptheme_progress_indeterminate_horizontal_holo_light</item>
</style>
<style name="SeekBarAppTheme" parent="android:Widget.Holo.Light.SeekBar">
<item name="android:progressDrawable">@drawable/apptheme_scrubber_progress_horizontal_holo_light</item>
<item name="android:indeterminateDrawable">@drawable/apptheme_scrubber_progress_horizontal_holo_light</item>
<item name="android:thumb">@drawable/apptheme_scrubber_control_selector_holo_light</item>
</style>
<style name="RatingBarAppTheme" parent="android:Widget.Holo.Light.RatingBar">
<item name="android:progressDrawable">@drawable/apptheme_ratingbar_full_holo_light</item>
<item name="android:indeterminateDrawable">@drawable/apptheme_ratingbar_full_holo_light</item>
</style>
<style name="RatingBarBigAppTheme" parent="android:Widget.Holo.Light.RatingBar.Indicator">
<item name="android:progressDrawable">@drawable/apptheme_ratingbar_holo_light</item>
<item name="android:indeterminateDrawable">@drawable/apptheme_ratingbar_holo_light</item>
</style>
<style name="RatingBarSmallAppTheme" parent="android:Widget.Holo.Light.RatingBar.Small">
<item name="android:progressDrawable">@drawable/apptheme_ratingbar_small_holo_light</item>
<item name="android:indeterminateDrawable">@drawable/apptheme_ratingbar_small_holo_light</item>
</style>
<style name="ToggleAppTheme" parent="android:Widget.Holo.Light.Button.Toggle">
<item name="android:background">@drawable/apptheme_btn_toggle_holo_light</item>
</style>
非常感谢您的帮助。
将 actionOverflowMenuStyle 项添加到您的应用主题中
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="actionOverflowMenuStyle">@style/CMOptionsMenu</item>
</style>
<style name="CMOptionsMenu" parent="Widget.AppCompat.PopupMenu.Overflow">
<item name="android:popupBackground">your color code</item>
</style>
您可以像这样简单地添加行:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- To change the background of options menu-->
<item name="android:itemBackground">*Your_color*</item>
</style>
菜单/下拉菜单/微调器的背景颜色
几个选项之一:
编辑styles.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:popupMenuStyle">@style/PopupMenu</item>
<item name="android:popupBackground">#272727</item>
<item name="android:itemBackground">#cc9d3e</item>
</style>
在 res/menu/ 下创建 popup_menu.xml
,如下所示:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="32dp"
android:tint="@color/timeSettings"
app:popupTheme="@style/PopupMenu">
<item
android:id="@+id/min0"
android:orderInCategory="100"
android:title="0"
app:showAsAction="never" />
</menu>
编辑 java-file
中的 popupMenu:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_clock);
//Time
secBtn = (Button) findViewById(R.id.btn_sec);
secBtn.setText("00");
//levelBtn.setTypeface(tf1);
secBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
PopupMenu popupMenu = new PopupMenu(MainActivityClock.this, secBtn);
popupMenu.getMenuInflater().inflate(R.menu.popup_menu_sec, popupMenu.getMenu());
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
//Toast.makeText(MainActivity.this, "" + item.getTitle(), Toast.LENGTH_SHORT).show();
secBtn.setText("" + item.getTitle());
workTime_sec = Integer.parseInt(item.getTitle().toString());
//sec = item.getTitle().toString();
System.out.println("workTime_sec: " + workTime_sec);
return true;
}
});
popupMenu.show();
}
});
}
Rakesh Kalashetti 的回答对我做了一个小改动 - actionOverflowMenuStyle
必须以 android:
命名空间为前缀,即:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:actionOverflowMenuStyle">@style/CMOptionsMenu</item>
</style>
<style name="CMOptionsMenu" parent="Widget.AppCompat.PopupMenu.Overflow">
<item name="android:popupBackground">your color code</item>
</style>