Android examples for android.text:SpannableString
get Spannable String from start, end, color
import android.text.Spannable; import android.text.SpannableStringBuilder; import android.text.style.ForegroundColorSpan; public class Main{ public static SpannableStringBuilder getSpannableString( SpannableStringBuilder content, int start, int end, int color) { if (content == null) { return null; }// w w w . ja v a 2s . c o m if (start < 0) { start = 0; } if (end > content.length()) { end = content.length(); } content.setSpan(new ForegroundColorSpan(color), start, end, Spannable.SPAN_EXCLUSIVE_INCLUSIVE); return content; } }