Code example for SpannableStringBuilder

Methods: append, length, setSpan

0
 
        if (d == null) {
            return; 
        } 
 
        int len = text.length();
        text.append("\uFFFC");
 
        text.setSpan(new ImageSpan(d, src), len, text.length(),
                     Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    } 
 
    private static void startFont(SpannableStringBuilder text, Element node) {
        String color = node.attr("color");
        String face = node.attr("face");
 
        int len = text.length();
        text.setSpan(new Font(color, face), len, len, Spannable.SPAN_MARK_MARK);
    } 
 
    private static void endFont(SpannableStringBuilder text) {