如何更改上下文菜单标题的文本颜色?
目前,我的styles.xml如下:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="@android:style/Theme.Material.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="android:colorPrimary">@color/colorPrimary</item>
<item name="android:colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="android:colorAccent">@color/colorAccent</item>
<item name="android:contextPopupMenuStyle">@style/ContextMenuStyle</item>
</style>
<style name="ContextMenuStyle"
parent="@android:style/TextAppearance.Material.Widget.PopupMenu">
</style>
<style name="ContextMenuStyle.Header"
parent="@android:style/TextAppearance.Material.Widget.PopupMenu.Header">
<item name="android:textColor">@android:color/black</item>
</style>
</resources>
但是gradle在构建时给了我很多错误,例如: app / src / main / res / values / styles.xml:16:5-19:13:AAPT:检索项目的父项时出错:未找到与给定名称'@android:style / TextAppearance.Material.Widget匹配的资源。 PopupMenu.Header'。
我从Android来源获得了样式名称TextAppearance.Material.Widget.PopupMenu.Header: https://android.googlesource.com/platform/frameworks/base/+/master/core/res/res/values/styles_material.xml
在styles.xml中设置上下文菜单的文本颜色的正确方法是什么?