Themes.xml无法在appcompat 23上运行

时间:2016-06-28 11:35:16

标签: android xml themes

我正在开发一个使用max api 21和appcompat-v7:21.0.0库的应用程序。迁移到api 23并appcompat到同一版本后,themes.xml不会对api 21及更高版本产生影响。

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="AAAActionBarTheme"
        parent="@style/Theme.AppCompat.Light">
        <item name="android:actionBarStyle">@style/AAAActionBar</item>
        <item name="android:popupMenuStyle">@style/AAAPopupMenu</item>
        <item name="android:itemTextAppearance">@style/AAAPopupMenuTextAppearance</item>
        <item name="android:actionOverflowButtonStyle">@style/AAAPopupMenuButtonOverflow</item>

        <!-- Support library compatibility -->
        <item name="actionBarStyle">@style/AAAActionBar</item>
        <item name="popupMenuStyle">@style/AAAPopupMenu</item>
    </style>

    <style name="AAAActionBar"
        parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
        <item name="android:background">@color/action_bar</item>
        <item name="android:textColor">@color/white</item>

        <!-- Support library compatibility -->
        <item name="background">@color/action_bar</item>
    </style>

    <style name="AAAPopupMenu"
        parent="android:Widget.Holo.Light.ListPopupWindow">
        <item name="android:popupBackground">@color/action_bar</item>

        <!-- Support library compatibility -->
        <item name="background">@color/action_bar</item>
    </style>

    <style name="AAAPopupMenuTextAppearance">
        <item name="android:textColor">@color/white</item>
    </style>

    <style name="AAAPopupMenuButtonOverflow" parent="android:style/Widget.Holo.ActionButton.Overflow">
        <item name="android:src">@drawable/ic_action_overflow</item>
    </style>

</resources>

有人可以帮我解决这个问题吗? 谢谢你的帮助。

1 个答案:

答案 0 :(得分:0)

在AppCompat 23中,只有已知的解决方案是更改为新工具栏并扩展AppCompatActivity,然后使用setSupportActionBar(工具栏)进行设置