Skip to content

Instantly share code, notes, and snippets.

@navczydev
Created July 10, 2021 01:53
Embed
What would you like to do?
// add badge to alarm
val badgeDrawable = activityMainBinding.navigationRail?.getOrCreateBadge(R.id.alarms)
badgeDrawable?.run {
Toast.makeText(applicationContext, "Create badge", Toast.LENGTH_SHORT).show()
number = 999
badgeTextColor =
ContextCompat.getColor(applicationContext, android.R.color.holo_red_light)
maxCharacterCount = 2
badgeGravity = BadgeDrawable.TOP_START
isVisible = true
}
// remove badge
// activityMainBinding.navigationRail?.removeBadge(R.id.alarms)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment