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!
Desire Result!
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!
Desire Result!
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