更改 FloatingActionsMenu 标题的背景和字体颜色

change title‘s background and font color for FloatingActionsMenu

我想改变标题的背景和字体颜色,怎么办!!

我只添加了这一行

label.setBackgroundColor(Color.BLUE);

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

    for (int i = 0; i < mButtonsCount; i++) {
      FloatingActionButton button = (FloatingActionButton) getChildAt(i);
      String title = button.getTitle();

      if (button == mAddButton || title == null ||
          button.getTag(R.id.fab_label) != null) continue;

      TextView label = new TextView(context);
      label.setTextAppearance(getContext(), mLabelsStyle);
      label.setText(button.getTitle());
      label.setBackgroundColor(Color.BLUE);      
      addView(label);

      button.setTag(R.id.fab_label, label);
    }
  }

我也有同样的问题,但我试过了,效果很好:D 在您的 XML 文件中,您使用:

xmlns:fab="http://schemas.android.com/apk/res-auto"

改为:

xmlns:fab="http://schemas.android.com/tools"

还有 setColor , setTitle 就像示例一样。