android弹出菜单文本颜色(AppCompat) [英] android popup menu text color (AppCompat)
本文介绍了android弹出菜单文本颜色(AppCompat)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要更改 popuo 菜单的文本颜色,但我找不到任何方法来执行此操作,我可以更改 popmenu 的背景但不能更改文本,我以这种方式编辑 style.xml:
I need to change text color of a popuo menu but I don't find any way for do this, I can change background of popmenu but not the text, I edit the style.xml in this way:
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
<!-- API 14 theme customizations can go here. -->
<item name="popupMenuStyle">@style/MyPopupMenu</item>
<item name="android:textAppearanceLargePopupMenu">@style/myPopupMenuTextAppearanceLarge</item>
<item name="android:textAppearanceSmallPopupMenu">@style/myPopupMenuTextAppearanceSmall</item>
</style>
<style name="MyPopupMenu" parent="@style/Widget.AppCompat.PopupMenu">
<item name="android:popupBackground">#0F213F</item>
</style>
<style name="myPopupMenuTextAppearanceSmall" parent="@style/TextAppearance.AppCompat.Base.Widget.PopupMenu.Small">
<item name="android:textColor">#ffffff</item>
</style>
<style name="myPopupMenuTextAppearanceLarge" parent="@style/TextAppearance.AppCompat.Base.Widget.PopupMenu.Large">
<item name="android:textColor">#ffffff</item>
</style>
错在哪里?
推荐答案
<item name="textAppearanceLargePopupMenu">@style/TextAppearance.AppCompat.Light.Widget.PopupMenu.Large</item>
<item name="textAppearanceSmallPopupMenu">@style/TextAppearance.AppCompat.Light.Widget.PopupMenu.Small</item>
我认为您正在使用 TextAppearance.AppCompat.Base.Widget.PopupMenu.这是错误,您正在使用另一个不响应当前样式的父项.
I think that you are using TextAppearance.AppCompat.Base.Widget.PopupMenu. Here is the error, you are using another parent that doesn´t response the current style.
你必须使用:
TextAppearance.AppCompat.Light.Widget.PopupMenu.
TextAppearance.AppCompat.Light.Widget.PopupMenu.
这篇关于android弹出菜单文本颜色(AppCompat)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文