2015-02-23 62 views
0

我試圖改變動作條的彈出菜單/下拉顏色:更改Android的下拉微調顏色程序兼容性

這是我有:

Styles.xml

<style name="Theme.Moy" parent="@style/Theme.AppCompat"> 
    <item name="colorPrimary">@color/red_moy</item> 
    <item name="colorPrimaryDark">@color/red_moy_satus_bar</item> 
    <item name="android:popupMenuStyle">@style/PopupMenu.Moy</item> 
    <item name="android:actionDropDownStyle">@style/myapp_DropDownNav</item> 
    <item name="android:actionBarWidgetTheme">@style/myapp.actionBarWidgetTheme</item> 
</style> 

<style name="myapp.actionBarWidgetTheme" parent="Theme.Moy"> 
    <item name="android:spinnerDropDownItemStyle">@style/myapp.Widget.DropDownItem.Spinner</item> 
</style> 

<style name="PopupMenu.Moy" parent="@style/Widget.AppCompat.PopupMenu"> 
    <item name="android:popupBackground">@color/red_moy_satus_bar</item> 
</style> 

<style name="myapp_DropDownNav" parent="@style/Widget.AppCompat.Spinner.DropDown.ActionBar"> 
    <item name="background">@drawable/menu_dropdown_panel_moy</item> 
    <item name="android:background">@drawable/menu_dropdown_panel_moy</item> 
    <item name="android:popupBackground">@drawable/menu_dropdown_panel_moy</item> 
    <item name="android:dropDownSelector">@drawable/menu_dropdown_panel_moy</item> 
</style> 

<style name="myapp.Widget.DropDownItem.Spinner" parent="Widget.AppCompat.DropDownItem.Spinner"> 
    <item name="android:textAppearance">@style/myapp.TextAppearance.Widget.DropDownItem</item> 
</style> 

<style name="myapp.TextAppearance.Widget.DropDownItem" parent="TextAppearance.AppCompat.Widget.DropDownItem"> 
    <item name="android:textColor">@color/gray_background_moy</item> 
</style> 

Styles.xml values-v1 4

<?xml version="1.0" encoding="utf-8"?> 
<resources> 

<style name="Theme.Moy" parent="@style/Theme.AppCompat"> 
    <item name="colorPrimary">@color/red_moy</item> 
    <item name="colorPrimaryDark">@color/red_moy_satus_bar</item> 
    <item name="android:popupMenuStyle">@style/PopupMenu.Moy</item> 
    <item name="android:actionDropDownStyle">@style/myapp_DropDownNav</item> 
    <item name="android:actionBarWidgetTheme">@style/myapp.actionBarWidgetTheme</item> 
</style> 

<style name="myapp.actionBarWidgetTheme" parent="Theme.Moy"> 
    <item name="android:spinnerDropDownItemStyle">@style/myapp.Widget.DropDownItem.Spinner</item> 
</style> 

<style name="PopupMenu.Moy" parent="@style/Widget.AppCompat.PopupMenu"> 
    <item name="android:popupBackground">@color/red_moy_satus_bar</item> 
</style> 

<style name="myapp_DropDownNav" parent="@style/Widget.AppCompat.Spinner.DropDown.ActionBar"> 
    <item name="background">@drawable/menu_dropdown_panel_moy</item> 
    <item name="android:background">@drawable/menu_dropdown_panel_moy</item> 
    <item name="android:popupBackground">@drawable/menu_dropdown_panel_moy</item> 
    <item name="android:dropDownSelector">@drawable/menu_dropdown_panel_moy</item> 
</style> 

<style name="myapp.Widget.DropDownItem.Spinner" parent="Widget.AppCompat.DropDownItem.Spinner"> 
    <item name="android:textAppearance">@style/myapp.TextAppearance.Widget.DropDownItem</item> 
</style> 

<style name="myapp.TextAppearance.Widget.DropDownItem" parent="TextAppearance.AppCompat.Widget.DropDownItem"> 
    <item name="android:textColor">@color/gray_background_moy</item> 
</style> 

它應該是紅色的,但它仍然是深灰色(默認)

感謝您的幫助!

回答

2

Themecompressed_在appcompat-v7中V21使用其自己的屬性作爲ActionBar,即沒有android:前綴。將它們編輯爲popupMenuStyle,actionDropDownStyleactionBarWidgetTheme