這是我的工具欄改變溢出菜單工具欄的文字和背景顏色
<?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及以上。
的可能的複製[工具欄選項菜單的背景顏色(http://stackoverflow.com/questions/29095733/toolbar-options-menu-background-顏色) –
如果我在xml中將popupTheme =「@ style/ToolbarStylepopuptheme」更改爲app:popupTheme =「@ style/ToolbarStylepopuptheme」文本顏色改變但背景不變化 – has19
與'app:'一起使用並將父項指定給樣式'ToolbarStylepopuptheme'與上述風格相同 – Harry