James Montemagno
James Montemagno

Live, Love, Bike, and Code.

Tags


Twitter


Control Text Size on Android Bottom Navigation View

James MontemagnoJames Montemagno

It seems as though my obsession with the Android Bottom Navigation View aka Bottom Tabs will never end! This time I got a question about controlling the size of the text when the user taps on a tab. The default behavior is to zoom in on the text:

Before

Inside of your Android project's Resources/values folder create a new file called dimens.xml if it doesn't exist. Then add the following XML to override the size of the text when it is active and not active:

<resources xmlns:tools="http://schemas.android.com/tools">
    <dimen name="design_bottom_navigation_text_size" tools:override="true">12sp</dimen>
    <dimen name="design_bottom_navigation_active_text_size" tools:override="true">12sp</dimen>
</resources>

After

Now for this to work you must be using Android Support libraries version 28 and higher. You also most likely want to turn off shifting. Enjoy and don't forget to read all about Bottom Tabs on the official documentation.


Tags



Live, Love, Bike, and Code

Checkout my monthly newsletter that you should subscribe to!

Comments