0

I'm working on an Android application and I'm trying to remove the background from a BottomNavigationView. Currently, it displays a purple (like a button) background, but I would like it to be transparent (or shadowed). Below is a screenshot of my current navigation bar:

enter image description here

Here is the XML code for the BottomNavigationView:

<com.google.android.material.bottomnavigation.BottomNavigationView
    android:id="@id/bottom_navigation"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@android:color/white"
    app:itemIconSize="32dp"
    app:itemIconTint="#263238"
    app:itemTextColor="@color/bottom_nav_text_color"
    app:labelVisibilityMode="unlabeled"
    app:layout_constraintBottom_toBottomOf="parent"
    app:menu="@menu/bottom_navigation_menu"
/>

And here is the menu XML:

<menu xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto">
    <item
        android:id="@+id/navigation_saved"
        android:icon="@drawable/outline_article_24"
        android:title="@string/saved_lists"
    />
    <item
        android:id="@+id/navigation_home"
        android:icon="@drawable/baseline_home_24"
        android:title="@string/home"
    />
    <item
        android:id="@+id/navigation_add"
        android:icon="@drawable/baseline_add_chart_24"
        android:title="@string/add"
    />
</menu>

How can I make the background of the BottomNavigationView Item transparent?

2
  • Check this answer, if it helps: stackoverflow.com/a/40326245/13500666 Commented Apr 27, 2024 at 14:47
  • nah it doesnt work, i need to change the whole nav bar i guess Commented Apr 27, 2024 at 17:50

1 Answer 1

0

In my case, I had to change the theme.xml accordingly:

   <style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
       
        <item name="colorAccent">@color/white</item>

The theme style was used in style.xml and I need to delete it there and use it only in the theme

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.