当我更改parent =“@ style / Theme.AppCompat.Light.DarkActionBar”>时,popupMenuStyle不起作用

时间:2014-01-27 12:41:58

标签: android android-actionbar themes

当我更改主题样式时

<style name="Theme.mystyle" parent="@style/Theme.AppCompat.Light">

<style name="Theme.mystyle" parent="@style/Theme.AppCompat.Light.DarkActionBar">

根本不工作。

<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>

1 个答案:

答案 0 :(得分:4)

选中此生成器以获取工作样式:http://jgilfelt.github.com/android-actionbarstylegenerator/

基本上,当切换到DarkActionBar时,您需要更新您的样式:

<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>