3

This is my toolbar

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/my_toolbar"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:background="?attr/colorPrimary"
    android:elevation="4dp"
    android:theme="@style/ToolbarTheme"
    popupTheme="@style/ToolbarStylepopuptheme" />

and my style.xml

<style name="ToolbarTheme" parent="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
    <item name="android:background">@color/colorPrimary</item>
    <item name="android:textColorPrimary">#ffffff</item>
    <item name="actionMenuTextColor">#ffffff</item>
</style>

<style name="ToolbarStylepopuptheme" >
    <item name="android:colorBackground">@android:color/darker_gray</item>
    <item name="android:textColor">#ffff55</item>
</style>

I already checked a lot on the internet, nothing seems to work for me. My app supports API level 16 and above.

Mike
  • 4,550
  • 4
  • 33
  • 47
has19
  • 1,307
  • 16
  • 31
  • 1
    Possible duplicate of [Toolbar options menu background color](http://stackoverflow.com/questions/29095733/toolbar-options-menu-background-color) – David Medenjak Jan 23 '16 at 12:48
  • if i changed popupTheme="@style/ToolbarStylepopuptheme" in xml to app:popupTheme="@style/ToolbarStylepopuptheme" the text color changes but the background is not changing – has19 Jan 23 '16 at 12:57
  • use with 'app:' and assign parent to the style 'ToolbarStylepopuptheme' same as above style – Harin Jan 23 '16 at 13:21

1 Answers1

0

Try to use :

<item name="android:popupBackground">@android:color/white</item>

or, add this : parent="@android:style/Widget.PopupMenu" and try it with your codes.

Finally:

<style name="ToolbarStylepopuptheme" parent="@android:style/Widget.PopupMenu">

And i forgot to say, my bad! add this(app) to your Toolbar:

app:popupTheme="@style/ToolbarStylepopuptheme"
ʍѳђઽ૯ท
  • 16,646
  • 7
  • 53
  • 108