Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 更改溢出菜单工具栏文本和背景色_Android_Toolbar - Fatal编程技术网

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"