0
スナックバーのアクションボタンの背景色を変更する方法、または消えるようにする方法はありますか(灰色の背景)?スナックバーのアクションボタンの背景色を変更します
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();
と私の質問が重複していない:私はこのコードを使用
。私は、テキストの色ではなく背景色を求めています。最初に私たちは読んで、それから私たちは理解し、それから私たちは考えて、誰かの質問が重複していると書くことにしました。
可能な複製([スナックバーアクションテキストの色が変化していない] http://stackoverflow.com/questions/31116774/snackbar-action-text-color-not-changing) –
コードを追加できますか? –
あなたはカスタムスナックバーを作ってみることができます。 http://stackoverflow.com/a/33441214/4344258 –