i have text in textview
, want phrases note
in text select them , change color red color. how can this? there method this?
try
string text = "some text in text view."; string searchtext = "the"; int startpos = -1, endpos = -1; if(text.tolowercase().contains(searchtext.tolowercase())){ startpos = text.tolowercase().indexof(searchtext.tolowercase()); endpos = startpos + searchtext.length(); spannable spantext = spannable.factory.getinstance().newspannable(text); if (startpos != -1){ spantext.setspan(new foregroundcolorspan(color.red), startpos, endpos, spannable.span_exclusive_exclusive); yourtextview.settext(spantext); } }
Comments
Post a Comment