user24097535
user24097535

Reputation: 1

icons don't show their original design colours

I've implemented a bottom navigation on my main activity view and set four icons in it, some are an orange shade and one has two colors: magenta and orange. There is something interfering with them displaying their original colours and would go dark grey for inactive icons and I believe black when they go active.

I've tried setting the app:itemIconTint to @null but then they take the color thats defined in the themes.xml file, before no colour was defined and icons showed a lavender colour. Icons have different colours.

mainActivity menu_yo vector image original color colors xml

Upvotes: 0

Views: 211

Answers (1)

Harshal Powankar
Harshal Powankar

Reputation: 1

Define custom colors for your icons like this:

<com.google.android.material.bottomnavigation.BottomNavigationView
...
app:itemIconTint="@color/bottom_nav_icon_color"
... />

And in your colors.xml:

<color name="bottom_nav_icon_color">@null</color>

Changing colors when icons become active or inactive, you can specify different colors for these states in your XML:

<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/active_icon_color" android:state_checked="true" />
<item android:color="@color/inactive_icon_color" />

Themes: If you're still seeing unexpected colors, check your theme settings. Sometimes, themes can override specific settings like icon colors.

Upvotes: 0

Related Questions