Android examples for android.text:SpannableString
make Spannable String from string and TextSpan
import android.text.SpannableString; import android.text.style.CharacterStyle; import android.text.style.SubscriptSpan; import java.util.ArrayList; import java.util.List; public class Main{ public static SpannableString makeSpannableString(String text, List<TextSpan> textSpans) { text = fixupSubscripts(text, textSpans); SpannableString ss = new SpannableString(text); for (TextSpan ts : textSpans) { ss.setSpan(ts.style, ts.start, ts.end, 0); }//from w w w. ja v a 2 s .c om return ss; } public static SpannableString makeSpannableString(String text) { return makeSpannableString(text, new ArrayList<TextSpan>()); } }