当我改变父popupMenuStyle不起作用=" @风格/ Theme.AppCompat.Light.DarkActionBar"> [英] popupMenuStyle doesn't work when I change parent="@style/Theme.AppCompat.Light.DarkActionBar">
本文介绍了当我改变父popupMenuStyle不起作用=" @风格/ Theme.AppCompat.Light.DarkActionBar">的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我改变我的主题样式
<样式名称=Theme.mystyle父=@风格/ Theme.AppCompat.Light>
到
<样式名称=Theme.mystyle父=@风格/ Theme.AppCompat.Light.DarkActionBar>
不工作的。
<样式名称=PopupMenu.mystyle父=@风格/ Widget.AppCompat.Light.PopupMenu>
<项目名称=机器人:TEXTSTYLE>大胆< /项目>
<项目名称=机器人:popupBackground> @可绘制/ menu_dropdown_panel< /项目>
< /风格>
解决方案
选中此发生器获得工作风格:的 http://jgilfelt.github.com/android-actionbarstylegenerator/
基本上切换时DarkActionBar你需要更新你的风格遵循:
<样式名称=Theme.Example父=@风格/ Theme.AppCompat.Light.DarkActionBar>
<项目名称=机器人:popupMenuStyle> @风格/ PopupMenu.Example< /项目>
<! - Light.DarkActionBar具体 - >
<项目名称=机器人:actionBarWidgetTheme> @风格/ Theme.Example.Widget< /项目>
< /风格>
<! - 这种风格只引用一个Light.DarkActionBar基于主题 - >
<样式名称=Theme.Example.Widget父=@风格/ Theme.AppCompat>
<项目名称=机器人:popupMenuStyle> @风格/ PopupMenu.Example< /项目>
<项目名称=机器人:dropDownListViewStyle> @风格/ DropDownListView.Example< /项目>
< /风格>
When I change my theme styles
<style name="Theme.mystyle" parent="@style/Theme.AppCompat.Light">
to
<style name="Theme.mystyle" parent="@style/Theme.AppCompat.Light.DarkActionBar">
Not working at all.
<style name="PopupMenu.mystyle" parent="@style/Widget.AppCompat.Light.PopupMenu">
<item name="android:textStyle">bold</item>
<item name="android:popupBackground">@drawable/menu_dropdown_panel</item>
</style>
解决方案
Check this generator to get working styles: http://jgilfelt.github.com/android-actionbarstylegenerator/
Basically when switching to DarkActionBar you need to update your styles to follow:
<style name="Theme.Example" parent="@style/Theme.AppCompat.Light.DarkActionBar">
<item name="android:popupMenuStyle">@style/PopupMenu.Example</item>
<!-- Light.DarkActionBar specific -->
<item name="android:actionBarWidgetTheme">@style/Theme.Example.Widget</item>
</style>
<!-- this style is only referenced in a Light.DarkActionBar based theme -->
<style name="Theme.Example.Widget" parent="@style/Theme.AppCompat">
<item name="android:popupMenuStyle">@style/PopupMenu.Example</item>
<item name="android:dropDownListViewStyle">@style/DropDownListView.Example</item>
</style>
这篇关于当我改变父popupMenuStyle不起作用=&QUOT; @风格/ Theme.AppCompat.Light.DarkActionBar&QUOT;&GT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文