James Montemagno
James Montemagno

Live, Love, Bike, and Code.

Tags


Twitter


James Montemagno

Removing BottomNavigationView’s Icon Shifting in Xamarin.Android

James MontemagnoJames Montemagno

I recently blogged about Android’s super fancy new BottomNavigationView, and how easy it was to get started with them in your Xamarin.Android application. 
BottomNavigationColor

I also went through a lot of color customizations that developers can blend in to really make their BottomNavigationView stand out. While this new bottom navigation is awesome, it is also still brand new with a lot of features locked behind internals and hidden fields, which is very sad. Recently I was asked about how to disable the “ShiftMode” of the icons on the bottom when more than 3 sections were added. I first had to go try it for myself to see what they were talking about and sure enough there it was:
ShiftMode

Yup, that is no good at all. I actually remember this from the first version of the Google I/O app and they scrambled to turn it off. Luckily, this is actually programmed into the underlying control but locked up in a hidden property. Do not fear as reflection is here! I wrote small utility class to turn it off:

And here you go!
BottomNavFixed

I have also updated my sample on GitHub with this code in it too!

Live, Love, Bike, and Code

Comments