Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/218.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 更改操作栏溢出菜单背景色_Android_Xml_Android Actionbar - Fatal编程技术网

Android 更改操作栏溢出菜单背景色

Android 更改操作栏溢出菜单背景色,android,xml,android-actionbar,Android,Xml,Android Actionbar,我添加了很多属性来更改溢出菜单的背景色,但似乎都不起作用 以下是我提到的几个链接(除了一些问题): res>值> style.xml <resources xmlns:android="http://schemas.android.com/apk/res/android"> <style name="AppBaseTheme" parent="android:Theme.Light"></style> <!-- Appli

我添加了很多属性来更改溢出菜单的背景色,但似乎都不起作用

以下是我提到的几个链接(除了一些问题):

res>值> style.xml

    <resources xmlns:android="http://schemas.android.com/apk/res/android">

    <style name="AppBaseTheme" parent="android:Theme.Light"></style>

    <!-- Application theme. -->
    <style name="AppTheme" parent="AppBaseTheme">
        <item name="android:actionBarStyle">@style/MyActionBar</item>
        <item name="android:dropDownListViewStyle">@style/MyDropDownListView</item>
        <item name="android:actionDropDownStyle">@style/MyDropDownNav</item>
        <item name="android:popupMenuStyle">@style/MyPopupMenu</item>
    </style>

    <style name="MyPopupMenu" parent="@android:style/Widget.Holo.ListPopupWindow">
        <item name="android:popupBackground">@drawable/menu_dropdown_panel</item>
    </style>

    <style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
        <item name="android:background">#28bda9</item>
        <item name="android:titleTextStyle">@style/Theme.MyAppTheme.ActionBar.TitleTextStyle</item>
    </style>

    <style name="Theme.MyAppTheme.ActionBar.TitleTextStyle" parent="android:style/TextAppearance.Holo.Widget.ActionBar.Title">
        <item name="android:textColor">#28bda9</item>
    </style>

    <!-- style the items within the overflow menu -->
    <style name="MyDropDownListView" parent="android:style/Widget.Holo.ListView.DropDown">
        <item name="android:listSelector">#28bda9</item>
    </style>

    <!-- style the list navigation -->
    <style name="MyDropDownNav" parent="android:style/Widget.Holo.Light.Spinner">
        <item name="android:background">#28bda9</item>
        <item name="android:popupBackground">#28bda9</item>
        <item name="android:dropDownSelector">#28bda9</item>
    </style>

</resources>

@样式/MyActionBar
@样式/MyDropDownList视图
@样式/MyDropDownNav
@样式/MyPopupMenu
@可绘图/菜单下拉菜单面板
#28bda9
@style/Theme.MyAppTheme.ActionBar.TitleTextStyle
#28bda9
#28bda9
#28bda9
#28bda9
#28bda9
编辑:我已更改代码以匹配解决方案。这就是错误:

<style name="MyPopupMenu" parent="@android:style/Widget.Holo.ListPopupWindow">
        <item name="android:popupBackground">**#28bda9**</item>
    </style>

**#28bda9**

你的思路是正确的,但是
弹出背景不仅仅是一种颜色

你得换一个抽屉

以下是Holo Light的默认可绘制选项(通常称为“菜单\下拉菜单\面板”)

使用您喜爱的图像编辑器更改颜色,并将其放在drawable-x文件夹中

所需的样式如下:

<style name="AppTheme" parent="AppBaseTheme">
    ...
    <item name="android:popupMenuStyle">@style/MyPopupMenu</item>
</style>

<style name="MyPopupMenu" parent="@android:style/Widget.Holo.ListPopupWindow">
    <item name="android:popupBackground">@drawable/menu_dropdown_panel</item>
</style>

...
@样式/MyPopupMenu
@可绘图/菜单下拉菜单面板

刚刚编辑了问题:似乎有问题:我尝试了上述解决方案如果您使用的是多个值文件夹(values-v11,values-v14),请确保您没有覆盖其他文件中的样式。v11和v14具有默认样式。xml文件也尝试在其他两个文件夹中复制此样式xml和过去的样式,这对他们没有帮助,我很糟糕。清理项目、工程:D