![](https://camo.githubusercontent.com/d70bb3a6012f7a6eef8b72c1832d9092e8317959f949dbe32cc83c0e201fb267/68747470733a2f2f6a69747061636b2e696f2f762f53686162616e4b616d656c6c2f566965774261646765722e737667)
Add BADGE
to any Android view at runtime.
![](https://github.com/ShabanKamell/ViewBadger/raw/master/blob/master/raw/screenshot.png)
Last Version ![](https://camo.githubusercontent.com/d70bb3a6012f7a6eef8b72c1832d9092e8317959f949dbe32cc83c0e201fb267/68747470733a2f2f6a69747061636b2e696f2f762f53686162616e4b616d656c6c2f566965774261646765722e737667)
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.ShabanKamell:ViewBadger:LAST.VERSION'
}
BadgeView badge = new ViewBadger().setupWithViewBottomNavigation(
bottomNavigationView,
1,
this
);
badge.setText("1111");
badge.show(true);
BadgeView badge = new ViewBadger().setupWithTabLayout(
tabLayout,
index,
TabLayoutMode.WITH_TITLE_AND_ICON,
getContext()
);
badge.setText("111");
badge.setOnClickListener(v -> viewPager.setCurrentItem(index));
badge.show(true);
Wrap the view with BadgeTarget
<com.sha.viewbadger.BadgeTarget
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/ivSquareLarge"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_gravity="center"
android:background="@drawable/btn_background"
/>
</com.sha.viewbadger.BadgeTarget>
BadgeView badge = new ViewBadger().setupWithView(
getView().findViewById(view),
R.id.root,
isRound,
getContext()
);
badge.setText("33");
badge.setOnClickListener(v -> viewPager.setCurrentItem(index));
badge.setPosition(position);
badge.show(true);
jgilfelt/android-viewbadger
See 'app' module for the full code.