Skip to content

Mojtaba-Shafaei/AndroidBadgeButton

Repository files navigation

AndroidToolbarBadgeButton

A customizable square button to use as toolbar button with badge number.

sample AndroidToolbarBadgeButton image

Methods

  • public void setBadgeNum(String text)
  • public void setBadgeBackgroundDrawable(Drawable drawable)
  • public void setBadgeBackgroundColor(int color)
  • public void setBadgeBackgroundResource(@DrawableRes int resId)
  • public void setBadgeTextColor(ColorStateList colorStateList)
  • public void setBadgeTextColor(int color)
  • public void setEnabled(boolean enabled)
  • public void setIcon(Drawable drawable)
  • public void setIcon(@DrawableRes int idRes)
  • public void setIcon(Bitmap bitmap)
  • fun setTypeFace(typeface: Typeface)

Xml attributes

app:icon Drawable of button(Icon) public void setIcon(Drawable drawable)
app:badgeBackground ColorStateList, Color, or Drawable public void setBadgeBackgroundDrawable(Drawable drawable)
app:textColor ColorStateList, Color public void setBadgeTextColor(ColorStateList colorStateList)

Installation

allprojects {
		repositories {
		
			maven { url 'https://jitpack.io' }
		}
	}
dependencies {
    implementation 'com.github.mojtaba-shafaei:androidbadgebutton:last-version'
}

Android Arsenal