Custom item's background inside a bottomnavigationview in Android

25 Views Asked by At

Can't change the background shape and color of items of bottomnavigationview when clicked

I want to change the shape and the color of the item's background by changing app:itemBackground but it doesn't take effect at all Here is my code of the bottom navigation view

<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bot_nav"
android:layout_width="match_parent"
android:layout_height="70dp"
android:background="@drawable/bottom_nav_background"
app:itemBackground="@drawable/oval_shape"
app:itemIconTint="@color/black"
app:itemPaddingBottom="10dp"
app:itemPaddingTop="15dp"
app:itemTextAppearanceActive="@style/BottomNavView"
app:itemTextAppearanceActiveBoldEnabled="true"
app:itemTextColor="@color/black"
app:labelVisibilityMode="selected"
app:menu="@menu/nav_menu"/>

and here's oval_shape.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <solid android:color="@color/blue_ripple"/>
    <corners android:radius="30dp"/>
</shape>

P/s: sorry everybody, I can't upload the image now due to an error of server. I will supplement it as soon as I can
P/s 2: I have fixed it myself, thank you all. By the way, if someone faces the same issue like me, try to change app:itemActiveIndicatorStyle instead.
Have a nice day !!!

0

There are 0 best solutions below