- Optimized badge for TabLayout
- Optimized badge for BottomNavigationView.
- Add badge to any view.
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);
<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);