还在羡慕这样的角标使用吗?
image.png是不是还在搜索各式各样的库哈!
这里给大家推荐一款适配还可以的角标库ShorCutBager
简单实用,
- Add mavenCentral to your build script.
repositories {
mavenCentral()
}
- Add dependencies for ShortcutBadger, it's available from maven now.
dependencies {
implementation "me.leolin:ShortcutBadger:1.1.22@aar"
}
- Add the codes below:
int badgeCount = 1;
ShortcutBadger.applyCount(context, badgeCount); //for 1.1.4+
ShortcutBadger.with(getApplicationContext()).count(badgeCount); //for 1.1.3
- If you want to remove the badge
ShortcutBadger.removeCount(context); //for 1.1.4+
ShortcutBadger.with(getApplicationContext()).remove(); //for 1.1.3
or
ShortcutBadger.applyCount(context, 0); //for 1.1.4+
ShortcutBadger.with(getApplicationContext()).count(0); //for 1.1.3
作者的GitHub地址
网友评论