0
我已经查看了所有的round stackoverflow如何在标签布局中的标签图标中添加徽章,但没有答案。在使用badgeView的Tablayout中的标签图标上添加徽章
这是我的代码
//Get reference to your Tablayout
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
tabLayout.setupWithViewPager(mViewPager);
tabLayout.getTabAt(0).setIcon(ICONS[0]);
tabLayout.getTabAt(1).setIcon(ICONS[1]);
tabLayout.getTabAt(2).setIcon(ICONS[2]);
BadgeView badge = new BadgeView(this, tabLayout.getTabAt(0).getCustomView());
badge.setText("1"); //Whatever value you should add
badge.show();
BadgeView mMotification = new BadgeView(this, tabLayout.getChildAt(1));
mMotification.setText("10");
mMotification.show();
我也尝试过很多其他的替代品,但它似乎像BadgeView只需意见