Search code examples
androidbottomnavigationviewmaterial-components-androidrippleripple-effect

Remove boundaries BottomNavigationView for ripple effect


I want the ripple effect to go beyond the bounds of the BottomNavigationView. How can i do this?

I have this xml:

<com.google.android.material.bottomnavigation.BottomNavigationView
            android:id="@+id/nav_view"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom"
            app:menu="@menu/bottom_nav_menu" />

Thanks in advance!


Solution

  • I found a solution.To assign Null value for the Bottom Navigation Instance at runtime. Please Try this,

    xml:

    <com.google.android.material.bottomnavigation.BottomNavigationView
                android:id="@+id/nav_view"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="bottom"
                android:background="@android:color/transparent"
                app:menu="@menu/bottom_nav_menu"
                android:elevation="0dp"/>
    

    java:

    BottomNavigationView navView = findViewById(R.id.nav_view);
    navView.setBackground(null);
    

    Happy Coding :)