Disable Shift Label Animation from Bottom Navigation — Android.

Make Bottom Navigation without animation like youtube, Instagram

Introduction:

In Android, now we have the bottom navigation, whenever we have three feature options or we have five options then we can use Bottom Navigation, If we have more then five options then we can move towards the Drawer Navigation.

Recently I have been working on an application in which I need to add a Bottom Navigation with five options, I successfully Implemented the bottom navigation but what I figured out that It’s animate when I switched the bottom tab option, It’s the default behavior, when you have five options It will animate the label whenever you switched the bottom tab.

After the R&D I found some answers on StackOverflow which they used the disable shift mode, but that was not working, so let’s get jump into it to see how you gonna disable this animation.

Visit my website at https://danishamjad.com/

As we know bydefault bottom navigation has multiple effects like Horizontal animation and text becomes larger when you select any item.

Disable Transitions Ways:

Image for post
Image for post
Transition1

The above transition we can remove by adding this

Image for post
Image for post
Transition2

Now, we can also show label and remove the translation together without app:itemHorizontalTranslationEnabled="false" this way

Image for post
Image for post
Transition3

If we want the same size of bottom navigation text then we can use the value of dimen.xml just add this line.

Image for post
Image for post
Transition4

That’s it now we have proper bottom navigation without any transition, but now we have one last problem here.

Problem:

The one problem is still here, What if the menu text is a long text? What if it was made of 2 words?

you will see the long text trimmed when the menu is selected. (Please look at the third menu)

Image for post
Image for post
Transition5

Solution:

You just need to hide the long text and show the small text by doing like this below snippet of code.

Image for post
Image for post
Final Result

Conclusion:

This article described you how to disable the different transitions of the bottom navigation, how you gonna show the small text size, how you controlled the long-text.

I hope this article is helpful. If you think something is missing, have questions, or would like to give feedback, go ahead and leave a comment below. I’d appreciate the feedback.

I’ve written some other Android-related content, and if you liked what you read here, you’ll probably also enjoy this:

Enjoy and Happy Coding!

Sharing (knowledge) is caring 😊 Thanks for reading this article. Be sure to clap or recommend this article if you found it helpful. It means a lot to me.

If you need any help then Join me on Twitter, LinkedIn, GitHub, and Subscribe to my Youtube Channel.

Senior Software Engineer(Android). Open Source Contributor, Technical Writer, Email: Dani.amjad12@gmail.com check my website at https://danishamjad.com/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store