Skip to content

Commit 267bd3d

Browse files
committed
see 02/26 log
1 parent fe3f39c commit 267bd3d

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

utilcode/src/main/java/com/blankj/utilcode/utils/SnackbarUtils.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,12 @@ private static void showSnackbar(View parent, CharSequence text,
134134
@ColorInt int textColor, @ColorInt int bgColor,
135135
CharSequence actionText, int actionTextColor,
136136
View.OnClickListener listener) {
137-
snackbarWeakReference = new WeakReference<>(Snackbar.make(parent, text, duration));
138-
Snackbar snackbar = snackbarWeakReference.get();
139-
View view = snackbar.getView();
140137
SpannableString spannableString = new SpannableString(text);
141138
ForegroundColorSpan colorSpan = new ForegroundColorSpan(textColor);
142139
spannableString.setSpan(colorSpan, 0, spannableString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
143-
snackbar.setText(spannableString);
140+
snackbarWeakReference = new WeakReference<>(Snackbar.make(parent, spannableString, duration));
141+
Snackbar snackbar = snackbarWeakReference.get();
142+
View view = snackbar.getView();
144143
view.setBackgroundColor(bgColor);
145144
if (actionText != null && actionText.length() > 0 && listener != null) {
146145
snackbar.setActionTextColor(actionTextColor);

0 commit comments

Comments
 (0)