如何更改AppCompat主题的下拉菜单背景颜色?

问题描述 投票:0回答:1

我尝试更改下拉菜单的背景,但找不到正确的决定。 http://i.stack.imgur.com/OqO4j.png

即我使用的../ values-v21 / styles.xml

<style name="AppTheme" parent="Theme.AppCompat.Light">

    <item name="colorPrimary">#009688</item>
    <item name="colorPrimaryDark">#00796B</item>
    <item name="android:textColorPrimary">#FFFFFF</item>
</style>

请解释,我该如何更改背景颜色。

android drop-down-menu android-support-library android-appcompat android-styles
1个回答
0
投票

由于您正在使用工具栏,因此可以使用类似以下的内容:

<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/action_bar_main"
    app:popupTheme="@style/popupTheme"
    ...../>

其中popupTheme是:

<style name="popupTheme" parent="ThemeOverlay.AppCompat.Light">
    <item name="android:textColorPrimary">@color/myTextColor</item>
    <item name="android:colorBackground">@color/myPopupBackgroundColor</item>
</style>
© www.soinside.com 2019 - 2024. All rights reserved.