BottomBar icon indicating copy to clipboard operation
BottomBar copied to clipboard

I want to add a badge without a count num

Open LiuDeng opened this issue 9 years ago • 5 comments

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

LiuDeng avatar Mar 28 '16 04:03 LiuDeng

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 avatar Jul 13 '16 07:07 goyourfly

@goyourfly 乛◡乛 It seems like my first time to use 'setTextSize(int unit, int size) ' . Thanks

w4mxl avatar Aug 11 '16 08:08 w4mxl

@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 avatar Jul 04 '17 04:07 vivchar

@vivchar your method works

thx~

loshine avatar Aug 11 '17 07:08 loshine

@vivchar when screen rotation occurs it always shows "1", seems like badgeTextView.setText(""); is not called after that configuration change

molps avatar Oct 20 '17 18:10 molps