Skip to content

可以支持富文本 #66

Description

@GuilinSir

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions