-
Notifications
You must be signed in to change notification settings - Fork 689
Badges
Ashok Varma edited this page Jul 3, 2016
·
7 revisions
add badge to BottomNavigationItem: you may add a BadgeItem for different tabs.
BadgeItem numberBadgeItem = new BadgeItem()
.setBorderWidth(4)
.setBackgroundColorResource(R.color.blue)
.setText("5")
.setHideOnSelect(autoHide.isChecked());
bottomNavigationBar
.addItem(new BottomNavigationItem(R.drawable.ic_home_white_24dp, "Home").setActiveColorResource(R.color.orange).setBadgeItem(numberBadgeItem))
Property | Description | Method | Values |
---|---|---|---|
Text | Text on the Badge | setText() | CharSequence |
Text Color | Badge Text Color | setTextColorResource(), setTextColor() | Resource/ColorCode(String)/Color |
BackgroundColor | Badge Background Color | setBackgroundColorResource(), setBackgroundColor() | Resource/ColorCode(String)/Color |
Border Width | Width of badge around border | setBorderWidth() | int (width in pixels) |
Border Color | Badge Border Color | setBorderColorResource(), setBorderColor() | Resource/ColorCode(String)/Color |
Gravity | Position of Badge on the BottomNavigationItem | setGravity() | Gravity.TOP/BOTTOM/LEFT/RIGHT (any combination of these) |
Hide On Select | Badge hides on Tab Selection, reappears when it is un-selected | setHideOnSelect() | boolean |
Animation Duration | Hide/Show Animation Duration | setAnimationDuration() | int (time in milliseconds) |
Property | Description | Method | Values |
---|---|---|---|
Hide | hides with animation | hide() | - |
UnHide/Show | un-hides with animation | show() | - |
Is Hidden | returns if the badge is hidden | isHidden() | boolean |
Toggle | toggles badge between hide/show | toggle() | - |
Get sample apk from Google Play Store