I am using the toolbar for android. I just want to change the background color of the overflow menu. But it is not changing.
Style xml
<style name="MyDarkToolbarStyle" parent="Widget.AppCompat.Toolbar">
<item name="popupTheme">@style/PopupMenuStyle</item>
<item name="theme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item>
</style>
<style name="PopupMenuStyle" parent="android:Widget.Holo.Light.PopupMenu">
<item name="android:popupBackground">@android:color/white</item>
</style>
Toolbar XML
<android.support.v7.widget.Toolbar
android:id="@+id/tool_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/ColorPrimary"
android:elevation="2dp"
android:theme="@style/MyDarkToolbarStyle" />
To change the toolbar options menu color, add this to your toolbar element
Then in your
styles.xml
define the popup menu styleNote that you need to use
colorBackground
notbackground
. The latter would be applied to everything (the menu itself and each menu item), the former applies only to the popup menu.Edit:
if you just want a white overflow popup menu just do this
and remove the redundant popupTheme your Style xml
You should also include this in your top (parent) Layout
Simplest way
If you just want a white overflow popup menu just do this:
Also, take a look at the value of
android:layout_height
attribute.