Search code examples
javaandroidxml

How do i get rid of this purple frame on icon on BottomNavigationBar


I'm doing my first app in Android Studio using java and can't get rid of a purple heighlight on a selected item in bottomNavigationBar. Is there any solution to get rid of it? bottomNavigationBar

I was adding different attributes and none of them works

Main activity:

  <com.google.android.material.bottomnavigation.BottomNavigationView
        android:id="@+id/bottomNavigationView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentStart="true"
        android:layout_alignParentEnd="true"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="20dp"
        android:layout_marginLeft="20dp"
        android:layout_marginRight="20dp"
        android:background="@drawable/tab_view_bg"
        android:elevation="2dp"
        app:itemBackground="@android:color/transparent"
        app:itemIconSize="30dp"
        app:itemIconTint="@color/icons_colors"
        app:itemRippleColor="@android:color/transparent"
        app:labelVisibilityMode="unlabeled"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:menu="@menu/bottom_nav_menu" />

Menu for the navigation bar:

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

    <item
        android:icon="@drawable/home"
        android:id="@+id/atlas" />
    <item
        android:icon="@drawable/fish"
        android:id="@+id/blank"/>
</menu>

Solution

  • So I had the same problem as u can see ..HERE... And I found an easy fix for this.

    You Only need to change the theme of your project and then it will be gone. Check this in your current project under res\values\themes and set the below theme.

    <resources>
        <!-- MyApplication is your application. you only need to change the parent theme -->
        <style name="Base.Theme.MyApplication" parent="Theme.MaterialComponents.DayNight.NoActionBar">
    

    Then it will be solved. I hope this helps.