23

I am using

compile 'com.android.support:design:25.0.0'

Android Bottom Navigation View and its height is is fixed and tiny icons with small text are shown. My question is how can i increase their sizes? I've tried to change size in xml file through style... all other properties are working except textsize property.

Can i do that pragmatically if so, then please write a code

Ramsha Omer
  • 1,022
  • 1
  • 8
  • 28

5 Answers5

51

I've found a solution to override some dimen values in dimens.xml file it works for the text size but icon still remains tiny. Here is how i do that. Hope this code will help others too :-)

<!-- Overriding Default Bottom Navigation sizes-->
    <dimen name="design_bottom_navigation_text_size" tools:override="true">16sp</dimen>
    <dimen name="design_bottom_navigation_active_text_size" tools:override="true">20sp</dimen>
    <dimen name="design_bottom_navigation_height" tools:override="true">70dp</dimen>
Ramsha Omer
  • 1,022
  • 1
  • 8
  • 28
  • 1
    Worked! Thanks @RamshaS – Kenny Dabiri May 25 '17 at 15:09
  • It increases the height of the bottom navigation view, not the icon size. – gopalanrc Oct 19 '18 at 09:46
  • I think a link to the `BottomNavigationView` source code would be helpful here. To find other dimension attributes look here: https://github.com/material-components/material-components-android/blob/master/lib/java/com/google/android/material/bottomnavigation/res/values/dimens.xml – Bruno Bieri Sep 03 '21 at 08:44
22

To expand on RamshaS answer for those who are looking to increase other values as well. Here are a list of all the values that can be set

bottom_navigation_elevation
bottom_navigation_height
bottom_navigation_icon
bottom_navigation_margin_bottom
bottom_navigation_margin_top_active
bottom_navigation_margin_top_inactive
bottom_navigation_max_width
bottom_navigation_min_width
bottom_navigation_notification_elevation
bottom_navigation_notification_height
bottom_navigation_notification_margin_left
bottom_navigation_notification_margin_left_active
bottom_navigation_notification_margin_top
bottom_navigation_notification_margin_top_active
bottom_navigation_notification_margin_top_classic
bottom_navigation_notification_padding
bottom_navigation_notification_radius
bottom_navigation_notification_text_size
bottom_navigation_notification_width
bottom_navigation_padding_left
bottom_navigation_padding_right
bottom_navigation_small_active_max_width
bottom_navigation_small_active_min_width
bottom_navigation_small_inactive_max_width
bottom_navigation_small_inactive_min_width
bottom_navigation_small_margin_bottom
bottom_navigation_small_margin_top
bottom_navigation_small_margin_top_active
bottom_navigation_small_selected_width_difference
bottom_navigation_text_size_active
bottom_navigation_text_size_forced_active
bottom_navigation_text_size_forced_inactive
bottom_navigation_text_size_inactive
Kobus Pitzer
  • 574
  • 1
  • 4
  • 13
20

it is default

<dimen name="design_bottom_navigation_active_item_max_width">168dp</dimen>
<dimen name="design_bottom_navigation_active_item_min_width">96dp</dimen>
<dimen name="design_bottom_navigation_active_text_size">14sp</dimen>
<dimen name="design_bottom_navigation_elevation">8dp</dimen>
<dimen name="design_bottom_navigation_height">56dp</dimen>
<dimen name="design_bottom_navigation_icon_size">24dp</dimen>
<dimen name="design_bottom_navigation_item_max_width">96dp</dimen>
<dimen name="design_bottom_navigation_item_min_width">56dp</dimen>
<dimen name="design_bottom_navigation_margin">8dp</dimen>
<dimen name="design_bottom_navigation_shadow_height">1dp</dimen>
<dimen name="design_bottom_navigation_text_size">12sp</dimen>
<color name="design_bottom_navigation_shadow_color">#14000000</color>
UgAr0FF
  • 805
  • 8
  • 18
8

The correct values of Bottom Navigation that you can override in dimens.xml like @RamshaS replied are the following

design_bottom_navigation_active_item_max_width
design_bottom_navigation_active_text_size
design_bottom_navigation_elevation
design_bottom_navigation_height
design_bottom_navigation_item_max_width
design_bottom_navigation_item_min_width
design_bottom_navigation_margin
design_bottom_navigation_shadow_height
design_bottom_navigation_text_size
design_bottom_navigation_item_background
design_bottom_navigation_item
design_bottom_navigation_shadow_color

I tried to set many values of @Kobus Pitzer's list but in dimens.xml with overriding mode not working. They are probably values that can overriden by code and not by dimens.xml

bl4ckr0se
  • 606
  • 8
  • 15
-1

I used scaleX and scaleY on the BottomNavigationView, with adding start and end padding to adjust the bottombar icons into desired position. Solves the icon and text size problem for different screen sizes.

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140