-
Notifications
You must be signed in to change notification settings - Fork 689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add badge later #31
Labels
Milestone
Comments
you can Add the badge before creating the BottomBar. and make the badge hide. whenever requires you can call show. Here is the sample code snippet.
//-------------------------------------------------------------
BadgeItem numberBadgeItem = new BadgeItem()
.setBorderWidth(4)
.setBackgroundColorResource(R.color.blue)
.setText("hai");
//-------------------------------------------------------------
bottomNavigationBar
.addItem(new BottomNavigationItem(R.drawable.ic_location_on_white_24dp, "Location").setActiveColorResource(R.color.orange).setBadgeItem(numberBadgeItem))
.addItem(new BottomNavigationItem(R.drawable.ic_find_replace_white_24dp, "Find").setActiveColorResource(R.color.teal))
.addItem(new BottomNavigationItem(R.drawable.ic_favorite_white_24dp, "Favorites").setActiveColorResource(R.color.blue))
.setFirstSelectedPosition(1)
.initialise();
//-------------------------------------------------------------
numberBadgeItem.hide();
numberBadgeItem.show().setText("1") |
@EpsilonOrionis if it works you can close this issue |
in 1.2.2 you can call hide on badge before attaching it to the bottomNavigationBar. Here is the sample code snippet.
//-------------------------------------------------------------
BadgeItem numberBadgeItem = new BadgeItem()
.setBorderWidth(4)
.setBackgroundColorResource(R.color.blue)
.setText("hai")
.hide();
//-------------------------------------------------------------
bottomNavigationBar
.addItem(new BottomNavigationItem(R.drawable.ic_location_on_white_24dp, "Location").setActiveColorResource(R.color.orange).setBadgeItem(numberBadgeItem))
.addItem(new BottomNavigationItem(R.drawable.ic_find_replace_white_24dp, "Find").setActiveColorResource(R.color.teal))
.addItem(new BottomNavigationItem(R.drawable.ic_favorite_white_24dp, "Favorites").setActiveColorResource(R.color.blue))
.setFirstSelectedPosition(1)
.initialise();
numberBadgeItem.show().setText("1") |
Thanks 👍 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is it possible to add a badge for a specific tab, when the BottomBar is already created?
The text was updated successfully, but these errors were encountered: