您使用下面的代码为小吃店设置背景颜色和操作文本颜色..
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar snackbar = Snackbar.make(
view,
"Snackbar: floatingActionButton1 (normal) clicked",
Snackbar.LENGTH_LONG);
snackbar.setActionTextColor(Color.RED);
View snackbarView = snackbar.getView();
snackbarView.setBackgroundColor(Color.WHITE);
TextView textView = (TextView) snackbarView.findViewById(android.support.design.R.id.snackbar_text);
textView.setTextColor(Color.BLUE);
snackbar.setAction("OK", new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(
getApplicationContext(),
"snackbar OK clicked",
Toast.LENGTH_LONG).show();
}
});
snackbar.show();
}
});