简体   繁体   English

更改底部导航视图的图标大小但图标覆盖文本?

[英]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.我增加了bottomView的高度,但仍然如此。

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?但我创建了 xml 并编写它但没有工具命名空间?

There is a property in bottom navigation view is app:itemIconSize="@dimen/_26sdp" where you can increase or decrease the icon size.底部导航视图中有一个属性是app:itemIconSize="@dimen/_26sdp" ,您可以在其中增加或减少图标大小。


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.BottomNavigationView中无法进行图标填充,您必须需要图标填充,然后您可以设置xml文件,如下所示。

test.xml测试.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截屏

底部导航

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM