Guest User

Untitled

a guest
Jul 19th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. The text will be wrapped in tags, and displayed in a monospaced font.
  2.  
  3. split(String separator);// it will return an array of Strings
  4. //in your case you will do somthing like this
  5. myWords = paragraph.split(" ");// the separator is the space
  6.  
  7. myNewParagraph.append(HTML.fromHtml("<font color...>... Your HTML Code to colorate your Text"));
  8.  
  9. Spannable spannableText = getSpannableText(yourTextView);
  10. spannableText.setSpan(new TextAppearanceSpan(...), wordStart, wordEnd)
  11. yourTextView.setText(spannableText);
  12.  
  13. private Spannable getSpannableText(TextView tv) {
  14. CharSequence cs = tv.getText();
  15. if (cs instanceof Spannable) {
  16. return (Spannable)cs;
  17. } else {
  18. return SpannableString.valueOf(cs);
  19. }
  20. }
Add Comment
Please, Sign In to add comment