删除工具栏片段中的透明背景

时间:2019-12-08 16:24:28

标签: java android android-fragments android-toolbar

我正在使用工具栏,其中溢出菜单选项具有透明背景,如图transparent overflow menu in toolbar enter image description here

所示。

我尝试编辑默认主题,还尝试了自定义主题以及使用面板背景选项。 有人可以让我知道如何使工具栏中的溢出菜单的背景不透明吗?

1 个答案:

答案 0 :(得分:0)

将您的基本主题更改为以下主题,它应该可以正常工作,因为它现在对我来说已经编译了。只需添加

<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>