如何更改快餐栏中操作按钮的背景颜色或使其消失(灰色背景)?
我使用这个代码:
Snackbar mysnack = Snackbar.make(main_layout, getResources().getString(R.string.snack_1), 5000);
View view = mysnack.getView();
TextView tv = (TextView) view.findViewById(android.support.design.R.id.snackbar_text);
tv.setTextColor(getResources().getColor(R.color.text_light));
mysnack.setActionTextColor(getResources().getColor(R.color.text_light));
mysnack.setAction("RATE", new View.OnClickListener() {
@Override
public void onClick(View view) {
Uri uri = Uri.parse(getResources().getString(R.string.snack_url));
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
});
TypedValue typedValue = new TypedValue();
getTheme().resolveAttribute(R.attr.colorPrimaryDark, typedValue, true);
final int color = typedValue.data;
mysnack.getView().setBackgroundColor(color);
mysnack.show();
我的问题不是重复的。我要求背景颜色而不是文本颜色。首先我们阅读,然后我们理解,然后我们思考,然后我们决定写下某人的问题是重复的。