Skip to content
This repository has been archived by the owner on Oct 23, 2020. It is now read-only.

FAB label programatically - not workin #85

Closed
ivanviragine opened this issue Jul 7, 2015 · 2 comments
Closed

FAB label programatically - not workin #85

ivanviragine opened this issue Jul 7, 2015 · 2 comments

Comments

@ivanviragine
Copy link

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:

  1. Put the labels on XML and hide then programatically if it's not the first time
  2. 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:

  1.  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));
    }
@ivanviragine
Copy link
Author

Not even via button.setLabelVisibility(View.GONE)!

Clans added a commit that referenced this issue Jul 8, 2015
@Clans
Copy link
Owner

Clans commented Jul 8, 2015

Fixed. Now the setLabelVisibility(View.GONE) method should work as expected. Will upload new build on weekends.

@Clans Clans closed this as completed Jul 8, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants