List of utility methods to do SpannableString Create
SpannableString | getSpanableText(String wholeText, String spanableText) get Spanable Text if (TextUtils.isEmpty(wholeText)) wholeText = ""; SpannableString spannableString = new SpannableString(wholeText); if (spanableText.equals("")) return spannableString; wholeText = wholeText.toLowerCase(); spanableText = spanableText.toLowerCase(); int startPos = wholeText.indexOf(spanableText); ... |
Spannable | makeColoredString(String text, int color) make Colored String Spannable result = new SpannableString(text); result.setSpan(new ForegroundColorSpan(color), 0, text.length(), Spannable.SPAN_INCLUSIVE_EXCLUSIVE); return result; |