0

I am making my app. I used preset from Android Studio with 3 items in bottom nav menu. Then I modified it for 5 items, add new fragments and so on. Also I downloaded my icons and add selectors to change icon of active item. But there is a problem. I see that all code work and icon changes, but I cant see my new icon, as icontint make all purple. I tried to change icon tint to null in different parts of code, but nothing helped.

This is my colors.xml

<resources>
    <color name="purple_200">#FFBB86FC</color>
    <color name="purple_500">#FF6200EE</color>
    <color name="purple_700">#FF3700B3</color>
    <color name="teal_200">#FF03DAC5</color>
    <color name="teal_700">#FF018786</color>
    <color name="black">#FF000000</color>
    <color name="white">#FFFFFFFF</color>
</resources>

This is my themes.xml

<resources xmlns:tools="http://schemas.android.com/tools">
    <!-- Base application theme. -->
    <style name="Theme.Myth" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
        <!-- Primary brand color. -->
        <item name="colorPrimary">@color/purple_700</item>
        <item name="colorPrimaryVariant">@color/purple_500</item>
        <item name="colorOnPrimary">@color/purple_200</item>
        <!-- Secondary brand color. -->
        <item name="colorSecondary">@color/teal_200</item>
        <item name="colorSecondaryVariant">@color/teal_700</item>
        <item name="colorOnSecondary">@color/black</item>
        <!-- Status bar color. -->
        <item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
        <!-- Customize your theme here. -->
    </style>
</resources>

bottom_nav_menu.xml

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">

    <item
        android:id="@+id/navigation_new"
        android:icon="@drawable/new_selector"
        android:title="@string/title_new" />

    <item
        android:id="@+id/navigation_bonus"
        android:icon="@drawable/bonus_selector"
        android:title="@string/title_bonus" />

    <item
        android:id="@+id/navigation_home"
        android:icon="@drawable/home_selector"
        android:title="@string/title_home" />

    <item
        android:id="@+id/navigation_menu"
        android:icon="@drawable/menu_selector"
        android:title="@string/title_menu" />

    <item
        android:id="@+id/navigation_profile"
        android:icon="@drawable/profile_selector"
        android:title="@string/title_profile" />

</menu>
Andrew
  • 1,947
  • 2
  • 23
  • 61
  • Please add your bottom navigation XML code to make it more clear – Neone Mar 19 '21 at 11:31
  • Added. If you need anything more, I am waiting – WhiteMelon Mar 19 '21 at 12:34
  • try with "Theme.MaterialComponents.Light.NoActionBar" – Neone Mar 19 '21 at 12:40
  • Thanks, but not. Now it crashes after start – WhiteMelon Mar 19 '21 at 15:53
  • Where did you put it and what's crash message – Neone Mar 19 '21 at 21:41
  • Also try "Theme.MaterialComponents.Light.DarkActionBar". It could be that you have actionBar set so it crashes because you say that you won't use it with "NoActionBar" – Neone Mar 19 '21 at 21:43
  • You should understand that this parent theme defines its own styles and colors depending on specified ones. So it can clash with what you try to recolor in your custom XML. You can also try to use non-material theme for your bottom navigation items by specifying style="@styles/AppTheme" – Neone Mar 19 '21 at 21:47

0 Answers0