code: public void toggleButton(final boolean visible) {
          if (isFabShowing != visible) {
              isFabShowing = visible;
              int height = fab.getHeight();
              if (height == 0) {
                  ViewTreeObserver vto = fab.getViewTreeObserver();
                  if (vto.isAlive()) {
                      vto.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
                          @Override
                          public boolean onPreDraw() {
                              ViewTreeObserver currentVto = fab.getViewTreeObserver();
                              if (currentVto.isAlive()) {
                                  currentVto.removeOnPreDrawListener(this);
                              }
                              toggleButton(visible);
                              return true;
                          }
                      });
                      return;
                  }
              }
              int translationY = visible ? 0 : height;
              fab.animate().setInterpolator(interpolator)
                      .setDuration(350)
                      .translationY(translationY);
  
              // On pre-Honeycomb a translated view is still clickable, so we need to disable clicks manually
              fab.setClickable(visible);
          }
      }
docs: Toggles the material floating action button.
  
  @param visible