无法设置ActionBar下拉导航的样式

时间:2016-03-29 11:32:09

标签: android android-layout android-actionbar

我的应用程序中有自己的样式主题。我正在尝试更改下拉导航的默认颜色方案。我添加了这些内容:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="Theme.Tema" parent="@android:style/Theme.Holo.Light">
        <item name="android:popupMenuStyle">@style/PopupMenu.MyAppTheme</item>
        <item name="android:actionDropDownStyle">@style/MyDropDownNav</item>
        <item name="android:actionBarStyle">@style/Theme.MyAppTheme.ActionBar</item>


        <item name="android:listSelector">@drawable/seletor2</item>
        <item name="android:panelFullBackground">@drawable/actionbarbackground</item>
        <item name="android:actionBarItemBackground">@drawable/ab_item_background</item>
        <item name="android:selectableItemBackground">@drawable/ab_item_background</item>
        <item name="android:actionBarDivider">@color/laranja</item>
        <item name="android:textColor">@color/verdeapp</item> // cor dos itens
    </style>
    <style name="PopupMenu.MyAppTheme" parent="@android:style/Widget.Holo.Light.ListPopupWindow">
        <item name="android:popupBackground">                          @drawable/popup_menu_bg_color</item>
    </style>

    <style name="Theme.MyAppTheme" parent="@android:style/Theme.Holo">
        <item name="android:actionBarStyle">@style/Theme.MyAppTheme.ActionBar</item>
        <item name="android:panelFullBackground">@drawable/actionbarbackground</item>
    </style>
    <style name="Theme.MyAppTheme.ActionBar" parent="@android:style/Widget.Holo.ActionBar">
        <item name="android:background">@drawable/actionbarbackground</item>
        <item name="android:popupBackground">@drawable/actionbarbackground</item>
        <item name="android:titleTextStyle">@style/Theme.MyAppTheme.titleTextStyle</item>

    </style>

    <style name="Theme.MyAppTheme.titleTextStyle" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title.Inverse">
        <item name="android:textColor">@color/branco</item>  // cor do título
    </style>

    <!-- style the list navigation -->
    <style name="MyDropDownNav">
        <item name="android:background">@color/orange</item>
        <item name="android:popupBackground">@color/vermelho</item>
        <item name="android:dropDownSelector">@drawable/seletor2</item>
    </style>
</resources>

TypeName

但是列表导航模式中的默认样式具有蓝色配色方案。什么都没有改变。

完整代码:

main.js:48 Uncaught TypeError: item.TypeName is not a function

1 个答案:

答案 0 :(得分:0)

覆盖appTheme中的下一个字段:

    <item name="popupMenuStyle">@style/AppTheme.PopupMenu</item>
    <item name="dropDownListViewStyle">@style/AppTheme.PopupMenuListView</item>
    <item name="textAppearanceLargePopupMenu">@style/AppTheme.Text.SingleLine.Common</item>
    <item name="textAppearanceSmallPopupMenu">@style/AppTheme.Text.SingleLine.Common</item>

<style name="AppTheme.PopupMenu" parent="Widget.AppCompat.PopupMenu">
    <item name="android:popupBackground">@drawable/abc_popup_background_mtrl_mult</item>
</style>

<style name="AppTheme.PopupMenuListView" parent="Widget.AppCompat.ListView.DropDown">
    <item name="android:listSelector">@drawable/pressed_state_background</item>
</style>

希望这有助于你。