Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

New BadgeView Counter With Java Android

NotificationsYou must be signed in to change notification settings

karim-eg/Smart-BadgeView

 
 

Repository files navigation

Display a badgeView on any view with RealTime Update.

StandWithPalestine

StandWithPalestine

Screenshot:

Step.1 Library implementation:

Add This Line To your build.gradle (lastest v1.0.9):

dependencies {implementation'com.github.karim-eg:Smart-BadgeView:1.0.9'}

Step.2 Create Private Variable:

privateBadgeViewbadgeView;

if you're using ide that didn't support auto import add these lines:

importcom.enceptcode.badgeview.BadgeFactory;importcom.enceptcode.badgeview.BadgeView;

Step.3 Add This Line atonCreate:

badgeView =BadgeFactory.createCircle(MainActivity.this);

You Can ReplacecreateCircle() property with:createDot(),createRectangle(),createOval(),createSquare(),createRoundRect()


Step.4 Add This Void:

privatevoidupdateBadge(finalStringcount,finalImageViewimage) {badgeView.setBadgeCount(count).setSpace(5,3).setTextSize(10).bind(image);}
  • you can add or change any property to other available methods:

.setTextColor(Color.White)

.setWidthAndHeight(25,25)

.setBadgeBackground(Color.Red)

.setTextSize(10)

.setBadgeGravity(Gravity.Right|Gravity.Top)

.setShape(BadgeView.SHAPE_CIRCLE)


Final Step:

finally add this line atonResume oronCreate to call the void you had created before and display badge.

updateBadge("21",imageview3);

void have two parameters first is the badge count, second is the view that badge will display on it.


to unbind view just useunbind method:

badgeView.unbind();

License

Apache License

Packages

No packages published

Languages

  • Java100.0%

[8]ページ先頭

©2009-2025 Movatter.jp