当我改变我的主题样式
<样式名称=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>