2

I'm trying increase spacing between icon and text, but in menu item doesn't work any padding.

enter image description here

Tried increase height android:layout_height="100dp" in com.google.android.material.bottomnavigation.BottomNavigationView doesn't work.

in menu item android:padding="12dp" doesn't work.

How can i fix this?

activity_main.xml

<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/popCategoryContainer"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        tools:context=".ui.main.MainActivity">

    <com.google.android.material.bottomnavigation.BottomNavigationView
        android:id="@+id/nav_view"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="@color/white"
        android:outlineProvider="bounds"
        android:theme="@style/ActionModeStyle"
        app:itemIconSize="30dp"
        app:itemIconTint="@color/bottom_navbar_selection"
        app:itemTextColor="@color/bottom_navbar_selection"
        app:labelVisibilityMode="labeled"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:itemTextAppearanceActive="@style/BottomNavigationView.Active"
        app:itemTextAppearanceInactive="@style/BottomNavigationView"
        app:menu="@menu/bottom_nav_menu" />

</androidx.constraintlayout.widget.ConstraintLayout>

bottom_nav_menu.xml

<menu xmlns:android="http://schemas.android.com/apk/res/android">

    <item
        android:id="@+id/navigation_home"
        android:icon="@drawable/ic_home"
        android:iconTintMode="screen"
        android:title="@string/title_home" />

    <item
        android:id="@+id/navigation_catalog"
        android:icon="@drawable/ic_catalog"
        android:title="@string/title_catalog" />
    <item
        android:id="@+id/navigation_basket"
        android:icon="@drawable/ic_shopping_cart"
        android:title="@string/title_basket" />

    <item
        android:id="@+id/navigation_favorites"
        android:icon="@drawable/ic_favorite_selector"
        android:title="@string/title_favorites" />

    <item
        android:id="@+id/navigation_profile"
        android:icon="@drawable/ic_profile"
        android:title="@string/profile" />

</menu>

3 Answers 3

1

For me it helped to set:

app:itemPaddingTop="0dp"
0

You can use this property on the BottomNavigationView

app:itemIconPadding="30dp"
0

Change padding on the BottomNavigationView

<com.google.android.material.bottomnavigation.BottomNavigationView
    ...
    app:itemPaddingTop="5dp"
    app:itemPaddingBottom="5dp"
    />

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.