Search code examples
androidkotlinbottomnavigationview

Remove the top padding in BottomNavigationView


I have a BottomNavigationView with a background showing for the selected item

Here's the bottom navigation XML:

<com.google.android.material.bottomnavigation.BottomNavigationView
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:layout_gravity="bottom"
            app:itemBackground="@drawable/bottombar_item_bg"/>

I want the items to match the bar height's and remove the top padding showing.

enter image description here


Solution

  • if I understand you true android:layout_height="?attr/actionBarSize" here you put height as 50dp so try change height to android:layout_height="35dp" or android:layout_height="40dp"