[英]Styling pop up menu with actionbarcompat
I've PopUpMenu
with support library v7 in my application which works as expected. 我的应用程序中有支持库v7的
PopUpMenu
,它可以按预期工作。 But styling PopUpMenu
is not working with styles of actionbarcompat
. 但是样式
PopUpMenu
不能与actionbarcompat
样式actionbarcompat
。
styles.xml
in values as follows : styles.xml
中的值如下:
<style name="Theme.Tellus" parent="@style/Theme.AppCompat.Light">
<item name="popupMenuStyle">@style/PopupMenu.Tellus</item>
<item name="dropDownListViewStyle">@style/DropDownListView.Tellus</item>
</style>
<style name="PopupMenu.Tellus" parent="@style/Widget.AppCompat.Light.PopupMenu">
<item name="android:listSelector">@drawable/selectable_background_tellus</item>
<item name="android:popupBackground">@drawable/menu_dropdown_panel_tellus</item>
<item name="android:textSize">16sp</item>
<item name="android:textColor">@android:color/white</item>
</style>
<style name="DropDownListView.Tellus" parent="@style/Widget.AppCompat.Light.ListView.DropDown">
<item name="android:listSelector">@drawable/selectable_background_tellus</item>
<item name="android:background">@color/background_actionbar</item>
<item name="android:textColor">#FFFFFF</item>
<item name="android:divider">@android:color/white</item>
<item name="android:dividerHeight">1dp</item>
</style>
Here is output what I'm getting after applying theme. 这是我应用主题后得到的输出。
It does display background of PopUpMenu
in blue color which is applied from dropDownListViewStyle
. 它确实以蓝色显示
PopUpMenu
背景,该背景从dropDownListViewStyle
应用。 How come PopUpMenu
using dropDownListViewStyle
? 为什么使用
dropDownListViewStyle
PopUpMenu
? If it's using then it should use all attributes of dropDownListViewStyle
如果正在使用,则应使用
dropDownListViewStyle
所有属性
I want to change MenuItem textColor
to white
which fits to my theme. 我想将
MenuItem textColor
更改为适合我主题的white
。 How can one apply style to MenuItem
textColor? 如何将样式应用于
MenuItem
textColor?
Any enlightenment will be welcomes 任何启发都将受到欢迎
try like this - 尝试这样-
<style name="Theme.Tellus" parent="@style/Theme.AppCompat.Light">
<item name="popupMenuStyle">@style/PopupMenu.Tellus</item>
<item name="dropDownListViewStyle">@style/DropDownListView.Tellus</item>
<item name="android:textColor">#FF0000</item>
</style>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.