How to change popup menu color in material3

Viewed 39

How can i change popup menu background color in material3. I have tried a lot but found no solutions. I had tried itemBacgroundColor also but it’s still in different color. I want it to white.

https://i.stack.imgur.com/gy1EQ.jpg

1 Answers

I don't sure about material, but you can change color of pop up menu like this:

add your style

    <style name="popupMenuStyle" parent="Widget.AppCompat.PopupMenu">
        <item name="android:background">@color/white</item>
    </style>

and when you init popup menu

val cornerPopupWrapper =ContextThemeWrapper(requireContext(),R.style.popupMenuStyle)
val popupMenu = PopupMenu(cornerPopupWrapper, it, Gravity.NO_GRAVITY)
Related