This repository was archived by the owner on Oct 23, 2020. It is now read-only.
FAB label programatically - not workin #85
Closed
Description
Hi there,
I'm trying to show the label of the button's programatically, only when user opens the app for the first time. So, I can do this two ways:
- Put the labels on XML and hide then programatically if it's not the first time
- Don't put the label on XML and show it if it's the first time
The 2) way makes more sense.
Neither can get me there.
Solution 1), when I set the label to null or "", the label appears empty (it should not even appear)
Solution 2), when I set the label programmatically, it doens't show (show empty, like on 1))
Am I missing something?
A little code:
-
if (fab != null && !app().getFirstLaunch()) { FloatingActionButton button = null;
for (int i = 0; i < fab.getChildCount(); i++) {
if (fab.getChildAt(i) instanceof FloatingActionButton) {
button = (FloatingActionButton) fab.getChildAt(i);
button.setLabelText(null);
}
}
}
if (fab != null && app().getFirstLaunch()) {
((FloatingActionButton) fab.getChildAt(0)).setLabelText(getString(R.string.fab_photo));
((FloatingActionButton) fab.getChildAt(1)).setLabelText(getString(R.string.fab_search));
((FloatingActionButton) fab.getChildAt(2)).setLabelText(getString(R.string.fab_notifications));
((FloatingActionButton) fab.getChildAt(3)).setLabelText(getString(R.string.fab_profiles));
((FloatingActionButton) fab.getChildAt(4)).setLabelText(getString(R.string.fab_feed));
}
Metadata
Metadata
Assignees
Labels
No labels