You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
在process(boolean setText)方法中的settext之前处理newText,例如
SpannableString spannableString = new SpannableString(newText);
int a = newText.toString().indexOf(data);
Log.e(TAG, "a=" + a);
while (a != -1) {
ForegroundColorSpan colorSpan = new ForegroundColorSpan(ContextCompat.getColor(getContext(), R.color.colorAccent));
spannableString.setSpan(colorSpan, a, data.length() + a, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
a = newText.toString().indexOf(data, a + 1);
Log.e(TAG, "a=" + a);
}
setText(spannableString);
The text was updated successfully, but these errors were encountered:
在process(boolean setText)方法中的settext之前处理newText,例如
SpannableString spannableString = new SpannableString(newText);
int a = newText.toString().indexOf(data);
Log.e(TAG, "a=" + a);
while (a != -1) {
ForegroundColorSpan colorSpan = new ForegroundColorSpan(ContextCompat.getColor(getContext(), R.color.colorAccent));
spannableString.setSpan(colorSpan, a, data.length() + a, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
a = newText.toString().indexOf(data, a + 1);
Log.e(TAG, "a=" + a);
}
setText(spannableString);
The text was updated successfully, but these errors were encountered: