I am not able to remove space below the navigation view icon in android studio. What;s wrong with code?

25 Views Asked by At

i am including my code for your reference and also the screen when app is launched.

<LinearLayout 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/main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="bottom"
    android:orientation="vertical"
    android:padding="0dp"
    tools:context=".dashboard">
<com.google.android.material.bottomnavigation.BottomNavigationView
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:background="#6000BCD4"
        android:padding="0dp"
        app:itemIconSize="20dp"
        app:itemPaddingBottom="0dp"
        app:itemPaddingTop="0dp"
 app:menu="@menu/bottom_nav_value" />
</LinearLayout>

This what i am getting

I want to remove extra spacing below the navigation view icons.

1

There are 1 best solutions below

1
Muhammad Shah On

use below code and use relative layout instead of linear layout.

<RelativeLayout
    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/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.google.android.material.bottomnavigation.BottomNavigationView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/nav_view"
        android:background="#6000BCD4"
        app:elevation="4dp"
        app:labelVisibilityMode="auto"
        app:itemHorizontalTranslationEnabled = "false"
        android:layout_alignParentBottom="true"
        app:itemIconSize="23sp"
        app:menu="@menu/bottom_nav_value"/>
    
</RelativeLayout>