android ActionBar的style.xml

android ActionBar的style.xml,android,Android,我为我的androidActionBar制作了一个styl.xml和所需的.png文件。 下面是style.xml: <resources> <style name="Theme.Example" parent="@android:style/Theme.Holo.Light"> <item name="android:actionBarItemBackground">@drawable/ab_selectable_backgroun

我为我的androidActionBar制作了一个styl.xml和所需的.png文件。 下面是style.xml:

<resources>

    <style name="Theme.Example" parent="@android:style/Theme.Holo.Light">
        <item name="android:actionBarItemBackground">@drawable/ab_selectable_background_example</item>
        <item name="android:popupMenuStyle">@style/PopupMenu.Example</item>
        <item name="android:dropDownListViewStyle">@style/DropDownListView.Example</item>
        <item name="android:actionBarTabStyle">@style/ActionBarTabStyle.Example</item>
        <item name="android:actionDropDownStyle">@style/DropDownNav.Example</item>
        <item name="android:actionBarStyle">@style/ActionBar.Solid.Example</item>
        <item name="android:actionModeBackground">@drawable/cab_background_top_example</item>
        <item name="android:actionModeSplitBackground">@drawable/cab_background_bottom_example</item>
        <item name="android:actionModeCloseButtonStyle">@style/ActionButton.CloseMode.Example</item>


    </style>

    <style name="ActionBar.Solid.Example" parent="@android:style/Widget.Holo.Light.ActionBar.Solid">
        <item name="android:background">@drawable/ab_background_textured_example</item>
        <item name="android:backgroundStacked">@drawable/ab_stacked_solid_example</item>
        <item name="android:backgroundSplit">@drawable/ab_background_textured_example</item>
        <item name="android:progressBarStyle">@style/ProgressBar.Example</item>
    </style>

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

    <style name="PopupMenu.Example" parent="@android:style/Widget.Holo.Light.ListPopupWindow">
        <item name="android:popupBackground">@drawable/menu_dropdown_panel_example</item>   
    </style>

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

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

    <style name="DropDownNav.Example" parent="@android:style/Widget.Holo.Light.Spinner">
        <item name="android:background">@drawable/ab_spinner_background_ab_example</item>
        <item name="android:popupBackground">@drawable/menu_dropdown_panel_example</item>
        <item name="android:dropDownSelector">@drawable/ab_selectable_background_example</item>
    </style>

    <style name="ProgressBar.Example" parent="@android:style/Widget.Holo.Light.ProgressBar.Horizontal">
        <item name="android:progressDrawable">@drawable/ab_progress_horizontal_example</item>
    </style>

    <style name="ActionButton.CloseMode.Example" parent="@android:style/Widget.Holo.Light.ActionButton.CloseMode">
        <item name="android:background">@drawable/btn_cab_done_default_example</item>
    </style>

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

</resources>
进入:


我的应用程序从一开始就崩溃了:有没有可能因为我使用

import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBar;
我对此不确定。如果我这样做了,我如何修复它,因为我想给我的ActionBar一个不同的颜色和高度属性

或者我应该删除ActionBar并使用新工具栏。我不确定我是否可以用它,因为它是从新的材料设计,只为Lolipop和更高的权利

thx的帮助

可以使用

或者阅读教程:

尝试用下面的主题声明替换主题声明

替换这个

<style name="Theme.Example" parent="@android:style/Theme.Holo.Light">

用这个

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


您可能需要在项目中添加Android支持库v7。

将每个Holo替换为AppCompat。我的意思是,在你找到的每一行中,用AppCompat替换它。在问题中添加崩溃日志。你的日志输出是什么意思?我已经尝试过只在特定的活动中使用自定义主题,然后它会出现以下情况:java.lang.IllegalStateException:你需要使用一个theme.AppCompat主题(或后代)此活动。“我是否可能需要一个AppCompat主题?”:是的。在ActionBarActivity的文档中提到过。现在我没有任何错误,但它没有应用主题:S我有所有可绘制的内容等。我的xml文件可以吗?或者我也需要在那里更改吗?使用此链接生成可绘制内容或操作栏自定义。使用google chrome进行此操作。
<style name="Theme.Example" parent="@android:style/Theme.Holo.Light">
 <style name="Theme.Example" parent="@style/Theme.AppCompat.Light">