Skip to content

Snappy1

  • Home
  • Android
  • What
  • How
  • Is
  • Can
  • Does
  • Do
  • Why
  • Are
  • Who
  • Toggle search form

[FIXED] android – Badge on bottomNavigationView padding or margin

Posted on November 11, 2022 By

Solution 1 :

You can use the method setVerticalOffset:

  BadgeDrawable badge = bottomNavigationView.getOrCreateBadge(menuItemId);
  badge.setNumber(...);
  badge.setVerticalOffset(20);  //The dimension is in pixel

Before:

enter image description here

After:

enter image description here

If it covers the icon you can also use the method setHorizontalOffset:

badge.setHorizontalOffset(-10);

enter image description here

Note: it requires at least the version 1.2.0-alpha01

Problem :

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 :

enter image description here

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

enter image description here

Comments

Comment posted by milad salimi

Oh thanks , i think i used 1.2.0 version let me check the 1.2.0-alpha version.

Comment posted by Gabriele Mariotti

@miladsalimi You can use the 1.2.0-beta01.

Comment posted by github.com/material-components/material-components-android/…

Thanks , then you merged

READ  [FIXED] java - when we click on link the webview not show any content
Powered by Inline Related Posts
Android Tags:android, android-layout, bottomnavigationview, kotlin, material-components-android

Post navigation

Previous Post: [FIXED] java – android studio 4.0 cannot load jdk class
Next Post: [FIXED] java – How can ViewParent be cast into View?

Related Posts

[FIXED] android – undefined is not an object (evaluating ‘data.map’) Android
[FIXED] Get bitmap from camera android Android
[FIXED] android – Navigate to fragment with NavController from notification Android
[FIXED] java – Volley sends null parameters to server when using post method Android
[FIXED] java – android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14 SQLITE_CANTOPEN): Could not open database Android
[FIXED] android – Kotlin failed to start emulator – ViewModel issue Android

Archives

  • April 2023
  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022

Categories

  • ¿Cómo
  • ¿Cuál
  • ¿Cuándo
  • ¿Cuántas
  • ¿Cuánto
  • ¿Qué
  • Android
  • Are
  • At
  • C'est
  • Can
  • Comment
  • Did
  • Do
  • Does
  • Est-ce
  • Est-il
  • For
  • Has
  • Hat
  • How
  • In
  • Is
  • Ist
  • Kann
  • Où
  • Pourquoi
  • Quand
  • Quel
  • Quelle
  • Quelles
  • Quels
  • Qui
  • Should
  • Sind
  • Sollte
  • Uncategorized
  • Wann
  • Warum
  • Was
  • Welche
  • Welchen
  • Welcher
  • Welches
  • Were
  • What
  • What's
  • When
  • Where
  • Which
  • Who
  • Who's
  • Why
  • Wie
  • Will
  • Wird
  • Wo
  • Woher
  • you can create a selvedge edge: You can make the edges of garter stitch more smooth by slipping the first stitch of every row.2022-02-04
  • you really only need to know two patterns: garter stitch

Recent Posts

  • Can Vicks humidifier be used without filter?
  • What color is Spanish green?
  • How old is Jamie in The War That Saved My Life?
  • When should I use scalp massager for hair growth?
  • Can I put polyurethane over liming wax?

Recent Comments

No comments to show.

Copyright © 2023 Snappy1.

Powered by PressBook Grid Dark theme