Android:动作栏中的样式溢出菜单

Android:动作栏中的样式溢出菜单,android,menu,styles,overflow,Android,Menu,Styles,Overflow,我正在我的项目中使用v7支持库。我的清单设置是: android:minSdkVersion="7" android:targetSdkVersion="15" 我使用Android操作栏样式生成器为我的操作栏生成样式。问题是,虽然所有功能都适用于最新的API,但我的溢出菜单在低API中不会改变(在emulator 2.2和real device 2.3.3 htc desire上测试) (这应该有红色背景) 菜单溢出是否正在加载其他组件中的项,如微调器对话框或其他东西(如

我正在我的项目中使用v7支持库。我的清单设置是:

    android:minSdkVersion="7"
    android:targetSdkVersion="15"
我使用Android操作栏样式生成器为我的操作栏生成样式。问题是,虽然所有功能都适用于最新的API,但我的溢出菜单在低API中不会改变(在emulator 2.2和real device 2.3.3 htc desire上测试)


(这应该有红色背景)

菜单溢出是否正在加载其他组件中的项,如微调器对话框或其他东西(如果听起来很愚蠢,请sry)?为什么一个api(ex 15)的样式不适用于其他api(ex 8),我可以做些什么来为所有api版本提供相同的溢出菜单

这是我最初从动作栏样式生成器生成的样式,我对它做了很多调整,但没有成功

<resources>

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

            <!-- Light.DarkActionBar specific -->
    <item name="actionBarWidgetTheme">@style/Theme.Example.Widget</item>

</style>

<style name="ActionBar.Solid.Example" parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
    <item name="background">@drawable/ab_solid_example</item>
    <item name="backgroundStacked">@drawable/ab_stacked_solid_example</item>
    <item name="backgroundSplit">@drawable/ab_bottom_solid_example</item>
    <item name="progressBarStyle">@style/ProgressBar.Example</item>
</style>

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

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

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

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

<style name="DropDownNav.Example" parent="@style/Widget.AppCompat.Spinner.DropDown.ActionBar">
    <item name="android:background">@drawable/spinner_background_ab_example</item>
    <item name="android:popupBackground">@drawable/menu_dropdown_panel_example</item>
    <item name="android:dropDownSelector">@drawable/selectable_background_example</item>
</style>

<style name="ProgressBar.Example" parent="@style/Widget.AppCompat.ProgressBar.Horizontal">
    <item name="android:progressDrawable">@drawable/progress_horizontal_example</item>
</style>

<style name="ActionButton.CloseMode.Example" parent="@style/Widget.AppCompat.ActionButton.CloseMode">
    <item name="android:background">@drawable/btn_cab_done_example</item>
</style>

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

@可绘制/可选择的\u背景\u示例
@style/PopupMenu.Example
@style/DropDownListView.Example
@style/ActionBartaStyle.Example
@style/DropDownNav.Example
@style/ActionBar.Solid.Example
@可绘图/驾驶室\背景\顶部\示例
@可绘制/驾驶室\背景\底部\示例
@style/ActionButton.CloseMode.Example
@style/Theme.Example.Widget
@可绘制/ab_实体_示例
@可绘制/ab_堆叠_实体_示例
@可绘制/ab_底部_实体_示例
@style/ProgressBar.Example
@可绘制/ab_透明_示例
@style/ProgressBar.Example
@可绘图/菜单\下拉菜单\面板\示例
@可绘制/可选择的\u背景\u示例
@可绘制/选项卡指示器选项卡示例
@可绘制/微调器\u背景\u ab\u示例
@可绘图/菜单\下拉菜单\面板\示例
@可绘制/可选择的\u背景\u示例
@可绘制/进度\水平\示例
@可牵引/btn\u驾驶室\u完成\u示例
@style/PopupMenu.Example
@style/DropDownListView.Example

为简单起见,
android:
命名空间适用于操作系统中内置的任何内容,而没有
android:
的任何内容都适用于您的应用程序(以及您正在使用的库)。大多数(如果不是全部的话)ActionBar的支持库将尝试使用本机ActionBar实现,因此在样式中使用
android:
命名空间属性。当本机ActionBar不可用时,它将使用库实现和非android:命名空间属性。这就是为什么您必须指定每个属性,无论是否使用
android:
名称空间。

我是这样做的:

<style name="Theme.yourapp" parent="@style/Theme.AppCompat.Light.DarkActionBar">
  <item name="android:actionBarWidgetTheme">@style/Theme.yourapp.Widget</item>
</style>

<style name="Theme.yourapp.Widget" parent="@style/Theme.AppCompat">
  <item name="android:textColor">@android:color/black</item>
</style>

@style/Theme.yourapp.Widget
@android:彩色/黑色

事实上是这样的。但是没有效果。。我花了几个小时才发现清除线头标记可以消除日食给我的警告。您可以指定需要使用android:namespace再次写入的属性吗。。也许我做错了什么。你使用的目录对吗?在
values-11
中,至少应该有
values
values-v11
和android名称空间属性。值和值-v14。in-values属性在没有android:namespace的情况下使用,而在values-v14中使用android: