android - How to color specific characters in an Arabic string? -


in arabic languages, specific characters colored rule. how can color characters. tried coloring using spannable string. sentence gets distorted.

here image show meant distorted.

distort text

there app (iquran) available on play google implements functionality.

enter image description here

so what's best way implement functionality?

the easiest way implement using html.

textview.settext(html.fromhtml("<i><small><font color=\"#c5c5c5\">" + "competitor id: " + "</font></small></i>" + "<font color=\"#47a842\">" + compid + "</font>")); 

you can use

string.replace("arabicchar","</font></small></i>arabicchar<font color=\"#c5c5c5\">" 

and use textview.settext(html.fromhtml(string));


Comments

Popular posts from this blog

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -