private void createLabels() {
    Context context = new ContextThemeWrapper(getContext(), mLabelsStyle);

    for (int i = 0; i < mButtonsCount; i++) {

      if (getChildAt(i) == mImageToggle) continue;

      final FloatingActionButton fab = (FloatingActionButton) getChildAt(i);
      String text = fab.getLabelText();

      if (fab == mMenuButton || TextUtils.isEmpty(text) || fab.getTag(R.id.fab_label) != null) {
        continue;
      }

      final Label label = new Label(context);
      label.setFab(fab);
      label.setShowAnimation(AnimationUtils.loadAnimation(getContext(), mLabelsShowAnimation));
      label.setHideAnimation(AnimationUtils.loadAnimation(getContext(), mLabelsHideAnimation));

      if (mLabelsStyle > 0) {
        label.setTextAppearance(getContext(), mLabelsStyle);
        label.setShowShadow(false);
        label.setUsingStyle(true);
      } else {
        label.setColors(mLabelsColorNormal, mLabelsColorPressed, mLabelsColorRipple);
        label.setShowShadow(mLabelsShowShadow);
        label.setCornerRadius(mLabelsCornerRadius);
        if (mLabelsEllipsize > 0) {
          setLabelEllipsize(label);
        }
        label.setMaxLines(mLabelsMaxLines);
        label.updateBackground();

        label.setTextSize(TypedValue.COMPLEX_UNIT_PX, mLabelsTextSize);
        label.setTextColor(mLabelsTextColor);

        int left = mLabelsPaddingLeft;
        int top = mLabelsPaddingTop;
        if (mLabelsShowShadow) {
          left += fab.getShadowRadius() + Math.abs(fab.getShadowXOffset());
          top += fab.getShadowRadius() + Math.abs(fab.getShadowYOffset());
        }

        label.setPadding(left, top, mLabelsPaddingLeft, mLabelsPaddingTop);

        if (mLabelsMaxLines < 0 || mLabelsSingleLine) {
          label.setSingleLine(mLabelsSingleLine);
        }
      }

      label.setText(text);

      addView(label);
      fab.setTag(R.id.fab_label, label);
    }
  }
  @Override
  protected void onLayout(boolean changed, int l, int t, int r, int b) {
    int buttonsHorizontalCenter =
        mLabelsPosition == LABELS_POSITION_LEFT
            ? r - l - mMaxButtonWidth / 2 - getPaddingRight()
            : mMaxButtonWidth / 2 + getPaddingLeft();
    boolean openUp = mOpenDirection == OPEN_UP;

    int menuButtonTop =
        openUp ? b - t - mMenuButton.getMeasuredHeight() - getPaddingBottom() : getPaddingTop();
    int menuButtonLeft = buttonsHorizontalCenter - mMenuButton.getMeasuredWidth() / 2;

    mMenuButton.layout(
        menuButtonLeft,
        menuButtonTop,
        menuButtonLeft + mMenuButton.getMeasuredWidth(),
        menuButtonTop + mMenuButton.getMeasuredHeight());

    int imageLeft = buttonsHorizontalCenter - mImageToggle.getMeasuredWidth() / 2;
    int imageTop =
        menuButtonTop + mMenuButton.getMeasuredHeight() / 2 - mImageToggle.getMeasuredHeight() / 2;

    mImageToggle.layout(
        imageLeft,
        imageTop,
        imageLeft + mImageToggle.getMeasuredWidth(),
        imageTop + mImageToggle.getMeasuredHeight());

    int nextY =
        openUp
            ? menuButtonTop - mButtonSpacing
            : menuButtonTop + mMenuButton.getMeasuredHeight() + mButtonSpacing;

    for (int i = mButtonsCount - 1; i >= 0; i--) {
      View child = getChildAt(i);

      if (child == mImageToggle) continue;

      FloatingActionButton fab = (FloatingActionButton) child;

      if (fab == mMenuButton || fab.getVisibility() == GONE) continue;

      int childX = buttonsHorizontalCenter - fab.getMeasuredWidth() / 2;
      int childY = openUp ? nextY - fab.getMeasuredHeight() : nextY;
      fab.layout(childX, childY, childX + fab.getMeasuredWidth(), childY + fab.getMeasuredHeight());

      if (!mMenuOpened) {
        fab.hide(false);
      }

      View label = (View) fab.getTag(R.id.fab_label);
      if (label != null) {
        int labelsOffset = fab.getMeasuredWidth() / 2 + mLabelsMargin;
        int labelXNearButton =
            mLabelsPosition == LABELS_POSITION_LEFT
                ? buttonsHorizontalCenter - labelsOffset
                : buttonsHorizontalCenter + labelsOffset;

        int labelXAwayFromButton =
            mLabelsPosition == LABELS_POSITION_LEFT
                ? labelXNearButton - label.getMeasuredWidth()
                : labelXNearButton + label.getMeasuredWidth();

        int labelLeft =
            mLabelsPosition == LABELS_POSITION_LEFT ? labelXAwayFromButton : labelXNearButton;

        int labelRight =
            mLabelsPosition == LABELS_POSITION_LEFT ? labelXNearButton : labelXAwayFromButton;

        int labelTop =
            childY
                - mLabelsVerticalOffset
                + (fab.getMeasuredHeight() - label.getMeasuredHeight()) / 2;

        label.layout(labelLeft, labelTop, labelRight, labelTop + label.getMeasuredHeight());

        if (!mMenuOpened) {
          label.setVisibility(INVISIBLE);
        }
      }

      nextY =
          openUp ? childY - mButtonSpacing : childY + child.getMeasuredHeight() + mButtonSpacing;
    }
  }