Android 更改溢出菜单工具栏文本和背景色
这是我的工具栏Android 更改溢出菜单工具栏文本和背景色,android,toolbar,Android,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="
<?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" />
还有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>
@颜色/原色
#ffffff
#ffffff
@android:颜色/深灰色
#ffff55
我已经在网上查了很多了,似乎什么都不适合我。我的应用程序支持API级别16及以上。尝试使用:
<item name="android:popupBackground">@android:color/white</item>
我忘了说,我的坏!将此(应用程序)添加到您的工具栏:
app:popupTheme="@style/ToolbarStylepopuptheme"
如果我将xml中的popupTheme=“@style/ToolbarStylepopuptheme”更改为app:popupTheme=“@style/ToolbarStylepopuptheme”,则可能存在重复文本颜色会改变,但背景不会随“app:”而改变,并将父项指定给样式“Toolbar StylePopupTheme”,与上述样式相同我正在android 5.0上测试它,如果这可能会有所不同Jesus!:),看看这个:在
5.1.1
上工作。你说,5
?意思是21 api
?是的,我使用的是普通样式对不起,我没有看到你使用的是android,请再次检查我的答案。让我们来看看。
app:popupTheme="@style/ToolbarStylepopuptheme"