这是我的工具栏
<?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" />
和我的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>
我已经在互联网上查了很多,似乎没有什么对我有用。我的应用支持API级别16及以上。
答案 0 :(得分:0)
尝试使用:
<item name="android:popupBackground">@android:color/white</item>
或者,添加:parent="@android:style/Widget.PopupMenu"
并尝试使用您的代码。
最后:
<style name="ToolbarStylepopuptheme" parent="@android:style/Widget.PopupMenu">
我忘了说,我的坏!将此(应用)添加到工具栏:
app:popupTheme="@style/ToolbarStylepopuptheme"