how do i set background color black to only characters and white background color between the characters in only single TextView android studio Example in image
Like in image it shows A is having background color black and the space between A and B is having white background color. How can to achieve it?

In this case you should use
SpannableString. Assume, you have thisStringand you need to set black background only under
BandEletters. This could be achieved in this way (examples written in Kotlin) :Here method
highlightsearches passed words occurrences in passed text and highlights every occurrence usingColor.BLACKcolor. To highlight spaces with white color you can do the same by passing" "space String, or just set the white background to all text view.