如何更改菜单中背景的颜色?它默认是白色的。我更改了style.xml和菜单,但它仍然显示白色菜单。 是什么问题,此代码: 我可以删除如何更改菜单中背景的颜色?
android:theme="@style/your_custom_optionsMenuStyle"
形式的manifest.xml和菜单的颜色变成黑色。但我想知道这是好方法吗?并且在具有不同API的其他设备中是黑色的?
<item
android:id="@+id/menu_settings"
android:title="@string/menu_settings"
android:orderInCategory="100"/>
<item name="actionOverflowMenuStyle">@style/your_custom_optionsMenuStyle</item>
</menu>
style.xml文件: <
<!--
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>
<style name="your_custom_optionsMenuStyle" parent="AppBaseTheme">
<item name="android:popupBackground">#000000</item>
</style>
</resources>
清单:
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/your_custom_optionsMenuStyle"
>
的可能的复制[如何更改背景颜色弹出式菜单中的Android ](http://stackoverflow.com/questions/21231404/how-to-change-background-color-popup-menu-android) –
你有几个零? https://en.wikipedia.org/wiki/Web_colors#Hex_triplet –
[如何更改ActionBar菜单背景颜色(android 4&5)](http://stackoverflow.com/questions/28974855/how-to -change-actionbar-menu-background-color-android-4-5) – camelCaseCoder