Search code examples
androidandroid-styles

Android popup menu "two backgrounds"


I have attached the screenshot showing what I want to achieve. I want to achieve just one background for my popup menu. Now as you can see on the picture below my menu there is a second background? I want toi stay this one below (darker one) with rounded corners. How to fix this?

I am adding my style.xml

<style name="objectsmeasure_dark" parent="Theme.MaterialComponents.NoActionBar">

    <item name="colorPrimary">@color/a212121</item>
    <item name="colorPrimaryDark">@android:color/black</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="android:alertDialogTheme">@style/alert_dialog_dark</item>
    <item name="android:windowBackground">@color/colorWindowBackgroundNight</item>
    <item name="colorBg">@color/colorWindowBackgroundNight</item>
    <item name="colorBottomNavigationViewBg">@color/bottom_nav_view_bg_night</item>
    <item name="colorBottomNavigationViewItem">@color/bottom_nav_view_item_night</item>
    <item name="android:popupMenuStyle">@style/popup_menu_dark</item>
    <item name="popupMenuStyle">@style/popup_menu_dark</item>
    <item name="myBackgroundColor">@color/colorGrey</item>
    <item name="myEtBackgroundColor">@color/BF606060</item>
    <item name="myCardBackground">@color/a212121</item>
    <item name="myTextColor">@android:color/white</item>
    <item name="myTintColor">@android:color/white</item>
    <item name="myButtonColor">@color/colorButton</item>
    <item name="myHintTextColor">@color/B3FFFFFF</item>
    <item name="android:navigationBarColor">@android:color/black</item>
    <item name="dialogTheme">@style/dialog_dark</item>
    <item name="android:dialogTheme">@style/dialog_dark</item>
    <item name="android:windowContentTransitions">true</item>
    <item name="currentTheme">@style/objectsmeasure_dark</item>
</style>


<style name="popup_menu_dark" parent="Widget.AppCompat.PopupMenu">
    <item name="android:popupBackground">@color/dark</item>
</style>



<style name="alert_dialog_dark" parent="Theme.MaterialComponents.Dialog.Alert">
    <item name="colorPrimary">@color/colorButton</item>
    <item name="android:textColor">@android:color/white</item>
    <item name="android:textColorPrimary">@android:color/white</item>
    <item name="android:background">@color/dark</item>
    <item name="background">@color/dark</item>
    <item name="buttonBarPositiveButtonStyle">@style/alert_dialog_button_positive</item>
    <item name="buttonBarNegativeButtonStyle">@style/alert_dialog_button_negative</item>
</style>



<style name="dialog_dark" parent="Theme.MaterialComponents.Dialog">
    <item name="colorPrimary">@color/colorButton</item>
    <item name="android:textColor">@android:color/white</item>
    <item name="android:textColorPrimary">@android:color/white</item>
    <item name="android:background">@color/dark</item>
    <item name="background">@color/dark</item>
    <item name="buttonBarPositiveButtonStyle">@style/alert_dialog_button_positive</item>
    <item name="buttonBarNegativeButtonStyle">@style/alert_dialog_button_negative</item>
</style>

Thank you for any help.

enter image description here


Solution

  • I solved this issue. It turned out I mixed parent styles - MaterialComponents and AppCompat and once I standarize it the problem was gone.