I am using
to set BottomNavigationView in my android app. My question is
Create a layout with one Textview like below.
After initializing the BottomNavgationView, you have to inflate the layout and select the index of View item and set the count.
BottomNavigationView bottomNavigationView = (BottomNavigationView) findViewById(R.id.bottom_navigation);
BottomNavigationMenuView bottomNavigationMenuView =
(BottomNavigationMenuView) bottomNavigationView.getChildAt(0);
View v = bottomNavigationMenuView.getChildAt(1);
BottomNavigationItemView itemView = (BottomNavigationItemView) v;
View badge = LayoutInflater.from(this)
.inflate(R.layout.homescreen_count, bottomNavigationMenuView, false);
TextView tv = badge.findViewById(R.id.notification_badge);
tv.setText("22+");
itemView.addView(badge);