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-change) –
你可以添加代碼嗎? –
你可以嘗試製作一個自定義小吃吧。 http://stackoverflow.com/a/33441214/4344258 –