Search code examples
androidxmlnavbarhighlight

Android Studio: remove highlight of BottomNaviagationView Items


ive been trying to remove that highlight that comes up when an item in the navbar is selected. I only want to make them items change the color on selected and unselected and i just cant get it, i tried nearly everything.

Heres my code in the main.xml

 <com.google.android.material.bottomnavigation.BottomNavigationView
            android:id="@+id/bottom_navigation"
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:layout_alignParentBottom="true"
            app:itemIconTint="@drawable/selector"
            app:menu="@drawable/menu_navigation"  />

This is the code of the selector

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

    <item
        android:state_selected="true"
        android:color="#248f24"
        android:drawable="@color/black"/>
    <item
        android:state_selected="false"
        android:color="#d1d1e0"
        android:drawable="@color/design_default_color_background"/>

</selector>

And this is the menu navigation block

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

    <item
        android:id="@+id/swipe"
        android:icon="@drawable/flameicon"/>
    <item
        android:id="@+id/recipes"
        android:icon="@drawable/listicon"/>
    <item
        android:id="@+id/settings"
        android:icon="@drawable/settingsicon"/>

</menu>

If anyone could help thatd be much appreciated, thank you!

Nearly everything that xml possibly can do


Solution

  • The attribute i was looking for was "app:itemActiveIndicatorStyle="@android:color/transparent""