zawadz88/MaterialPopupMenu

When put a iconColor black (for example) the icon color is other than what is settted

Closed this issue · 5 comments

When put a iconColor black (for example) the icon color is other than what is settted

Hi @jrcacd,
Could you provide a code snippet of how you're using it and a screenshot of how it looks like, please?
Also, is this happening on any specific device, are you using Android Support Library or AndroidX?
Any details would be appreciated :)

I'm using AndroidX
Xiaomi redmi 5 plus
Android 8.1

val popupMenu = popupMenu {
            section {
                item {
                    label = R.string.change
                    icon = R.drawable.ic_edit_white_48px
                    iconColor = R.color.md_black_1000 // real black  <color name="md_black_1000">#000000</color>
                    callback = { ... }
                }
...
            }
        }

        popupMenu.show(...)

Result
screenshot_2018-10-26-08-42-07-431_com icecrystalcore mydic

It might be that AppCompat does some internap tinting based on your accent color. Is the result the same if you use a different icon, preferably one that's in your app assets?

Yes

OK, I think I see the issue now. You should be using a color int and not a color resource ID. So in your case this could be:

iconColor = ContextCompat.getColor(context, R.color. md_black_1000)