JsLaw
JsLaw

Reputation: 163

Bottom Navigation View menu item title size

Good Morning,

i am using bottom navigation view to do my bottom menu.

and now the title is too big and i can't found any solution to solve it

enter image description here

Upvotes: 10

Views: 15679

Answers (3)

Raviraj
Raviraj

Reputation: 926

 <com.google.android.material.bottomnavigation.BottomNavigationView
        android:id="@+id/bottom_navigation"
        android:layout_width="match_parent"
        android:layout_height="64dp"
        android:layout_gravity="bottom"
        android:background="@color/bg_grey"
      app:itemTextAppearanceActive="@style/BottomNavigationView.Active"
        app:itemTextAppearanceInactive="@style/BottomNavigationView"
        app:itemTextColor="@color/bottom_nav_color"
        app:labelVisibilityMode="labeled"
        app:menu="@menu/bottom_navigation_menu" />

styles.xml

<style name="BottomNavigationView" parent="@style/TextAppearance.AppCompat.Caption">
    <item name="android:textSize">10sp</item>
</style>

<style name="BottomNavigationView.Active" parent="@style/TextAppearance.AppCompat.Caption">
    <item name="android:textSize">11sp</item>
</style>

Upvotes: 6

Thamays
Thamays

Reputation: 3098

  1. Open values\dimens.xml
  2. add this code

    <dimen 
          name="design_bottom_navigation_text_size"   
          tools:override="true">11sp </dimen>
    
    <dimen 
          name="design_bottom_navigation_active_text_size" 
          tools:override="true">12sp </dimen>
    

Upvotes: 35

Israel
Israel

Reputation: 446

Create new style

<style name="NavigationViewOwnStyle">
 <item name="android:listPreferredItemHeightSmall">40dp</item><!-item height-->
 <item name="android:textSize">20sp</item> <!--item text size-->
</style>

and apply

<android.support.design.widget.NavigationView
    ...
    ...
    app:itemTextAppearance="@style/NavigationViewOwnStyle"
    ...
    ...
 />

Upvotes: -1

Related Questions