Android:更改弹出菜单的主题背景
当我点击动作栏中的一个项目时,我的popum菜单有一个黑色的背景主题颜色。我想改变我的弹出菜单的主题,以有一个全息光(白色)的颜色 我该怎么做 这是我的style.xml文件,目前为空:Android:更改弹出菜单的主题背景,android,android-theme,android-menu,Android,Android Theme,Android Menu,当我点击动作栏中的一个项目时,我的popum菜单有一个黑色的背景主题颜色。我想改变我的弹出菜单的主题,以有一个全息光(白色)的颜色 我该怎么做 这是我的style.xml文件,目前为空: <resources> <!-- Base application theme, dependent on API level. This theme is replaced by AppBaseTheme from res/values-vXX/st
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
</resources>
和舱单摘录:
<application
android:name="com.app.ccccccc.activities.cccccccc"
android:hardwareAccelerated="true"
android:allowBackup="true"
android:icon="@drawable/ic_action_blob"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
在操作菜单的一次单击上,您可以通过编程编写设置背景色的代码 或使用,
<style name="AppTheme" parent="android:Theme.Light">
<item name="android:popupMenuStyle">@style/PopupMenu</item>
</style>
<style name="PopupMenu" parent="@android:style/Widget.PopupMenu">
<item name="android:popupBackground">@android:color/white</item>
</style>
manifest.xml:
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
.............
</application>
@样式/弹出菜单
@android:彩色/白色
manifest.xml:
.............
在操作菜单的一次单击上,您可以通过编程编写设置背景色的代码
或使用,
<style name="AppTheme" parent="android:Theme.Light">
<item name="android:popupMenuStyle">@style/PopupMenu</item>
</style>
<style name="PopupMenu" parent="@android:style/Widget.PopupMenu">
<item name="android:popupBackground">@android:color/white</item>
</style>
manifest.xml:
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
.............
</application>
@样式/弹出菜单
@android:彩色/白色
manifest.xml:
.............
尝试按如下方式编辑您的style.xml
:
在基本主题中:
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
...
<item name="android:popupMenuStyle">@style/PopupMenuStyle</item>
</style>
请注意,默认的弹出式菜单样式不会像我上面所做的那样将背景设置为纯色,而是使用一个状态列表,该列表可使用9块背景绘制,以提供阴影等。尝试编辑
style.xml
,如下所示:
在基本主题中:
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
...
<item name="android:popupMenuStyle">@style/PopupMenuStyle</item>
</style>
请注意,默认的弹出式菜单样式不会像我上面所做的那样将背景设置为纯色,而是使用一个状态列表,可使用9块背景绘制,以提供阴影等。谢谢。你能告诉我我必须在style.xml文件中添加元素的位置吗?但是在style.xml文件中的位置呢?*不要删除style.xml中的内容,嘿,伙计,你知道“android:PopubBackground”对api<21不起作用吗?谢谢。你能告诉我在style.xml文件中必须在哪里添加元素吗?但是在style.xml文件中必须在哪里添加元素吗?*不要删除style.xml中的内容,嘿,伙计,你知道“android:popupBackground”对api<21不起作用吗?