How can we set margin to badge of bottomNavigation material component??
OR
How can we prevent to padding when we click on an item in bottomNavigationView because of that a little of badge will be hidden as we see in these pictures.
When item 1 is unSelected :

When item 1 isSelected (a little of badge height will be hidden):

You can use the method setVerticalOffset:
BadgeDrawable badge = bottomNavigationView.getOrCreateBadge(menuItemId);
badge.setNumber(...);
badge.setVerticalOffset(20); //The dimension is in pixel
Before:

After:

If it covers the icon you can also use the method setHorizontalOffset:
badge.setHorizontalOffset(-10);

Note: it requires at least the version 1.2.0-alpha01
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With