更新时间:2023-01-28 09:48:20
将此添加到工具栏元素
app:popupTheme="@style/ThemeOverlay.YourApp"
然后在您的styles.xml
中定义弹出菜单样式
Then in your styles.xml
define the popup menu style
<style name="ThemeOverlay.YourApp" parent="ThemeOverlay.AppCompat.Light">
<item name="android:colorBackground">@color/your_background_color</item>
<item name="android:textColor">@color/your_text_color</item>
</style>
请注意,您无需使用colorBackground
,而不必使用background
.后者将应用于所有内容(菜单本身和每个菜单项),前者仅应用于弹出菜单.
Note that you need to use colorBackground
and never background
. The latter would be applied to everything (the menu itself and each menu item), the former applies only to the popup menu.