我正在使用一个工具栏,其中溢出菜单选项具有透明背景,如图所示 transparent overflow menu in toolbar
我尝试过编辑默认主题,还尝试了自定义主题以及使用面板背景选项。 有人可以告诉我如何使工具栏中的溢出菜单的背景不透明吗?
最佳答案
更改您的基本主题,如下所示,它应该可以像我现在刚刚编译的那样工作。只需添加这个
<item name="android:itemBackground">@color/colorPrimaryDark</item>
主题:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:itemBackground">@color/colorPrimaryDark</item>
</style>
关于java - 删除工具栏 fragment 中的透明背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59237411/