Hello!
I'm currently trying to display some items programmatically on the bottom bar, without initializing them on the XML layout file. Do someone know how to do it? Or at least how to clean the pre-existent ones initialized through xml, so I won't end up with both (xml and programmatically) items on my screen (here at least when I call the getTabCount method, it display the sums of both).
Thanks!
I couldn't find a 'nice' way to do it, so this is how I did it:
BottomBarTab tab = mBottomBar.getTabWithId(R.id.tab_company);
if (tab != null) {
TextView title = (TextView) tab.findViewById(R.id.bb_bottom_bar_title);
if (title != null) {
title.setText(getTitle(this));
}
}
Where R.id.tab_company was the ID I set in the XML for that tab, and getTitle() above would return you the 'custom' text you wanted to use in the icon. May be prone to going horribly wrong in some scenarios, but it seems OK so far :)
I can see the source of BottomBarTab has a method setTitle(https://github.com/roughike/BottomBar/blob/master/bottom-bar/src/main/java/com/roughike/bottombar/BottomBarTab.java#L187) and doesn't seemed to be used anywhere inside the project.
It would be great if we can have a public method to set the both the icon and the title programmatically.
BTW this is very good lib, thanks for the work :)
Plx, put public setTitle
This is fixed in the upcoming 2.1.0.
Most helpful comment
I can see the source of
BottomBarTabhas a methodsetTitle(https://github.com/roughike/BottomBar/blob/master/bottom-bar/src/main/java/com/roughike/bottombar/BottomBarTab.java#L187) and doesn't seemed to be used anywhere inside the project.It would be great if we can have a public method to set the both the icon and the title programmatically.
BTW this is very good lib, thanks for the work :)