Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

可以支持富文本 #66

Open
GuilinSir opened this issue Jul 23, 2019 · 0 comments
Open

可以支持富文本 #66

GuilinSir opened this issue Jul 23, 2019 · 0 comments

Comments

@GuilinSir
Copy link

在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);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant