我想改变标题的背景和字体颜色,怎么办!!
问问题
636 次
2 回答
0
我只添加了这一行
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);
}
}
于 2015-03-22T08:35:38.997 回答
0
我有同样的问题,但我尝试了它工作正常:D 在您的 XML 文件中,您使用:
xmlns:fab="http://schemas.android.com/apk/res-auto"
反而 :
xmlns:fab="http://schemas.android.com/tools"
和 setColor 、 setTitle 一样的示例。
于 2015-09-29T19:13:04.860 回答