logcat中的错误:
10-20 13:51:31.926 12874-12874/com.project.android.tourism E/dalvikvm: Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method android.support.v7.widget.AppCompatImageHelper.hasOverlappingRendering
10-20 13:51:32.110 12874-12874/com.project.android.tourism E/dalvikvm: Could not find class 'android.widget.ThemedSpinnerAdapter', referenced from method android.support.v7.widget.AppCompatSpinner$DropDownAdapter.<init>
和代码:
TextView textViewSnack = (TextView) findViewById(android.support.design.R.id.snackbar_text);
textViewSnack.setTextColor(ContextCompat.getColor(PlaceActivity.this, R.color.colorPrimaryDark));
答案 0 :(得分:1)
试试这个,
您需要通过 view
的SnackBar
来查找 textView
的SnackBar
。
Snackbar snackbar = Snackbar.make(
coordinatorLayout,
"Snackbar: floatingActionButton1 (normal) clicked",
Snackbar.LENGTH_LONG);
snackbar.setActionTextColor(Color.RED); //to change the color of action text
View snackbarView = snackbar.getView();
snackbarView.setBackgroundColor(Color.WHITE);
TextView textView = (TextView) snackbarView.findViewById(android.support.design.R.id.snackbar_text);
textView.setTextColor(ContextCompat.getColor(PlaceActivity.this, R.color.colorPrimaryDark));