更改默认操作栏弹出菜单背景颜色

时间:2014-03-09 07:57:25

标签: android layout

我尝试使用样式更改弹出菜单的默认颜色:

<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
    <item name="android:popupMenuStyle">@style/PopUp</item>
</style>

<style name="PopUp" parent="@android:style/Widget.PopupMenu">
    <item name="android:popupBackground">@color/white</item>
</style>

我已经在app manifest中连接了这个主题。

<uses-sdk
    android:minSdkVersion="14"
    android:targetSdkVersion="19"/>

<application
    android:name=".MyApplication"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme">

但是,这不会更改弹出窗口的默认灰色背景。任何想法都错了吗?

1 个答案:

答案 0 :(得分:1)

我改变了

<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
    <item name="android:popupMenuStyle">@style/PopUp</item>
</style>

<style name="AppTheme" parent="android:Theme.Holo.Light">
    <item name="android:popupMenuStyle">@style/PopUp</item>
</style>

现在可以了。然而,似乎使用 android:Theme.Holo.Light.DarkActionBar ,您无法通过xml更改弹出窗口的样式。