zawadz88 / MaterialPopupMenu

Shows Material popup menus grouped in sections & more
Apache License 2.0
646 stars 57 forks source link

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

Closed jrcacd closed 5 years ago

zawadz88 commented 5 years ago

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

jrcacd commented 5 years ago

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

zawadz88 commented 5 years ago

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?

jrcacd commented 5 years ago

Yes

zawadz88 commented 5 years ago

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)