BottomBar
BottomBar copied to clipboard
I want to add a badge without a count num
I just want to add a badge without a count number I once post a issue here and you add it but have to set a unread number #66
BottomBarBadge bottomBarge = mBottomBar.makeBadgeForTabAt(0, Color.RED, 0); bottomBarge.setAnimationDuration(100); bottomBarge.setAutoShowAfterUnSelection(true); bottomBarge.setText(""); bottomBarge.setTextSize(TypedValue.COMPLEX_UNIT_SP, 1); bottomBarge.show();
不用谢...😄
@goyourfly 乛◡乛 It seems like my first time to use 'setTextSize(int unit, int size) ' . Thanks
@goyourfly Currently the BottomBarBadge has package visibility. I am using the reflection API to fix badge style:
private void showBadgeDot(final int tabID) {
try {
final BottomBarTab tab = mBottomBar.getTabWithId(tabID);
tab.setBadgeCount(1);
final Field badgeFieldDefinition = tab.getClass().getDeclaredField("badge");
badgeFieldDefinition.setAccessible(true);
final TextView badgeTextView = (TextView) badgeFieldDefinition.get(tab);
badgeTextView.setText("");
badgeTextView.setTextSize(6);
} catch (NoSuchFieldException | NullPointerException | IllegalAccessException ignored) {}
}
@vivchar your method works
thx~
@vivchar when screen rotation occurs it always shows "1", seems like badgeTextView.setText(""); is not called after that configuration change