从Android Action Bar Style Generator实现值-v14

时间:2014-06-30 05:31:26

标签: android xml android-resources

我正在尝试使用github http://jgilfelt.github.io/android-actionbarstylegenerator/

中的操作栏样式生成器设置操作栏的样式

我将所有文件复制到相应的文件夹中;但是我收到多个错误,因为我的min sdk是11,当需要14时,所以我必须创建一个值v14文件夹。

enter image description here

问题是,当我覆盖值-v14中的资源时,我收到此错误:

enter image description here

类型为@style

的意外资源引用类型预期值

生成的我的xml文件是:

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

<style name="Theme.Customaction" parent="@android:style/Theme.Holo">
    <item name="android:actionBarItemBackground">@drawable/selectable_background_customaction</item>
    <item name="android:popupMenuStyle">@style/PopupMenu.Customaction</item>
    <item name="android:dropDownListViewStyle">@style/DropDownListView.Customaction</item>
    <item name="android:actionBarTabStyle">@style/ActionBarTabStyle.Customaction</item>
    <item name="android:actionDropDownStyle">@style/DropDownNav.Customaction</item>
    <item name="android:actionBarStyle">@style/ActionBar.Transparent.Customaction</item>
    <item name="android:actionModeBackground">@drawable/cab_background_top_customaction</item>
    <item name="android:actionModeSplitBackground">@drawable/cab_background_bottom_customaction</item>
    <item name="android:actionModeCloseButtonStyle">@style/ActionButton.CloseMode.Customaction</item>


</style>

<style name="ActionBar.Solid.Customaction" parent="@android:style/Widget.Holo.ActionBar.Solid">
    <item name="android:background">@drawable/ab_solid_customaction</item>
    <item name="android:backgroundStacked">@drawable/ab_stacked_solid_customaction</item>
    <item name="android:backgroundSplit">@drawable/ab_bottom_solid_customaction</item>
    <item name="android:progressBarStyle">@style/ProgressBar.Customaction</item>
</style>

<style name="ActionBar.Transparent.Customaction" parent="@android:style/Widget.Holo.ActionBar">
    <item name="android:background">@drawable/ab_transparent_customaction</item>
    <item name="android:progressBarStyle">@style/ProgressBar.Customaction</item>
</style>

<style name="PopupMenu.Customaction" parent="@android:style/Widget.Holo.ListPopupWindow">
    <item name="android:popupBackground">@drawable/menu_dropdown_panel_customaction</item>  
</style>

<style name="DropDownListView.Customaction" parent="@android:style/Widget.Holo.ListView.DropDown">
    <item name="android:listSelector">@drawable/selectable_background_customaction</item>
</style>

<style name="ActionBarTabStyle.Customaction" parent="@android:style/Widget.Holo.ActionBar.TabView">
    <item name="android:background">@drawable/tab_indicator_ab_customaction</item>
</style>

<style name="DropDownNav.Customaction" parent="@android:style/Widget.Holo.Spinner">
    <item name="android:background">@drawable/spinner_background_ab_customaction</item>
    <item name="android:popupBackground">@drawable/menu_dropdown_panel_customaction</item>
    <item name="android:dropDownSelector">@drawable/selectable_background_customaction</item>
</style>

<style name="ProgressBar.Customaction" parent="@android:style/Widget.Holo.ProgressBar.Horizontal">
    <item name="android:progressDrawable">@drawable/progress_horizontal_customaction</item>
</style>

<style name="ActionButton.CloseMode.Customaction" parent="@android:style/Widget.Holo.ActionButton.CloseMode">
    <item name="android:background">@drawable/btn_cab_done_customaction</item>
</style>

<!-- this style is only referenced in a Light.DarkActionBar based theme -->
<style name="Theme.Customaction.Widget" parent="@android:style/Theme.Holo">
    <item name="android:popupMenuStyle">@style/PopupMenu.Customaction</item>
    <item name="android:dropDownListViewStyle">@style/DropDownListView.Customaction</item>
</style>

不确定如何处理并修复此错误

尝试遵循此http://www.androiduipatterns.com/2012/09/creating-custom-android-styles-easy-way.html

但没有运气。

1 个答案:

答案 0 :(得分:0)

当您使用Android Action Bar Style Generator时,您可能忘记选择Style compatibility列表,AppCompat项目高于API 7而Sherlock需要一个ActionBarSherlock库与您的应用。其默认项holo不适用于低Android版本。愿这有帮助。