更新时间:2021-10-09 01:20:06
您可以像这样在 actionbar
中更改下拉菜单
的背景颜色和文本颜色.
You can change the background color and text color of the dropdown menu
in the actionbar
like this.
在styles.xml中设置弹出菜单的样式.
Set the style for the popup menu in styles.xml.
<style name="PopupMenuStyle" parent="Theme.AppCompat.Light">
<item name="android:background">@color/YourColor</item>
<item name="android:textColor">@Color/YourColor</item>
</style>
现在将这种样式设置为工具栏
的 popupTheme
.
Now set this style as the popupTheme
for your toolbar
.
<android.support.v7.widget.Toolbar
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
// rest of your code
app:popupTheme="@style/PopupMenuStyle" />