0

This is what I have done!

spannableString.setSpan(new BackgroundColorSpan(ContextCompat.getColor(mContext, R.color.highlightColor)), 0, div.getText().length(), 0);
textview.setText(spannableString);

Result Achieved!

enter image description here

Desire Result!

enter image description here

Tulsi
  • 719
  • 7
  • 15

1 Answers1

0

Maybe this link can help you: Can I select a color for each text line I append to a TextView?

But instead of the ForegroundColorSpan try using the BackgroundColorSpan

Community
  • 1
  • 1
jennymo
  • 1,450
  • 1
  • 18
  • 43