user666
user666

Reputation: 318

change the icon size of the bottom-navigation view but the icon covers text?

I changed the icon size but it is overlapped with the text

I have increase the bottomView's height but still so.

only the side(margin?) changed.

I have searched and find the answer that

<dimen name="design_bottom_navigation_height" tools:override="true">56dp</dimen>

but I created the xml and write it but there is no tools namespace?

Upvotes: 0

Views: 843

Answers (1)

Pratik PSB
Pratik PSB

Reputation: 184

There is a property in bottom navigation view is app:itemIconSize="@dimen/_26sdp" where you can increase or decrease the icon size.


it worked for me. hope it also work for you. Have a nice day man :) .


UPDATE

Icon padding is not possible in BottomNavigationView you must need the icon padding then you can set your xml file like the given below.

test.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    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:layout_alignParentBottom="true"
        android:background="@color/white">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:gravity="center"
            android:orientation="horizontal"
            android:weightSum="5">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:layout_weight="1"
                android:drawablePadding="10dp"
                android:gravity="center"
                android:padding="10dp"
                android:text="ABC"
                app:drawableTopCompat="@drawable/ic_chat_bubble_orange_24dp" />

            <TextView
                android:id="@+id/test_2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:layout_weight="1"
                android:drawablePadding="10dp"
                android:gravity="center"
                android:padding="10dp"
                android:text="DEF"
                app:drawableTopCompat="@drawable/ic_chat_bubble_orange_24dp" />

            <TextView
                android:id="@+id/test_3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:layout_weight="1"
                android:drawablePadding="10dp"
                android:gravity="center"
                android:padding="10dp"
                android:text="DEF"
                app:drawableTopCompat="@drawable/ic_chat_bubble_orange_24dp" />

            <TextView
                android:id="@+id/test_4"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:layout_weight="1"
                android:drawablePadding="10dp"
                android:gravity="center"
                android:padding="10dp"
                android:text="DEF"
                app:drawableTopCompat="@drawable/ic_chat_bubble_orange_24dp" />

            <TextView
                android:id="@+id/test_5"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:layout_weight="1"
                android:drawablePadding="10dp"
                android:gravity="center"
                android:padding="10dp"
                android:text="DEF"
                app:drawableTopCompat="@drawable/ic_chat_bubble_orange_24dp" />

        </LinearLayout>

    </com.google.android.material.bottomnavigation.BottomNavigationView>

</RelativeLayout>

and your Design will look like the given below screenshot.


ScreenShot

bottom navigation

Upvotes: 1

Related Questions