简体   繁体   English

更改底部导航栏的大小

[英]Changing bottom navigation bar size

I have changed my icon's size but the title isn't fitting within the icon and is looking like this . 我更改了图标的大小,但标题不适合图标,看起来像这样 The icon size is 40dp. 图标大小为40dp。

Here is my code: 这是我的代码:

       <android.support.design.widget.BottomNavigationView
          android:id="@+id/navigationBar"
          android:layout_gravity="fill"
          android:layout_width="match_parent"
          android:layout_height="100dp"
          app:itemIconTint="@drawable/bottom_navigation_selection"
          app:itemTextColor="@drawable/bottom_navigation_selection"
          app:menu="@menu/bottom_navigation"
          android:background="@color/appBar"/>

and here is my dimens.xml: 这是我的dimens.xml:

    <dimen name="design_bottom_navigation_icon_size" tools:override="true">50dp</dimen>
    <dimen name="design_bottom_navigation_item_max_width" tools:override="true">600dp</dimen>
    <dimen name="design_bottom_navigation_active_item_max_width" tools:override="true">600dp</dimen>

I hope you guys can help me find a solution. 我希望你们能帮助我找到解决方案。 Thanks. 谢谢。

Add the following line in your BottomNavigationView: 在您的BottomNavigationView中添加以下行:

app:labelVisibilityMode="labeled"

Example: 例:

  <android.support.design.widget.BottomNavigationView
        android:id="@+id/navigation"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:background="@color/colorPrimaryDark"
        android:textSize="@dimen/tv_text_very_small"
        app:itemTextAppearanceActive="@style/BottomNavigationView.Active"
        app:itemTextAppearanceInactive="@style/BottomNavigationView"
        app:itemIconTint="#000000"
        app:itemTextColor="#000000"
        app:labelVisibilityMode="labeled"
        app:menu="@menu/bottom_tabs" />

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

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