Code example for SpannableStringBuilder

Methods: append

0
        spannable1.setSpan(span1, 0, spannable1.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        spannable2.setSpan(span2, 0, spannable2.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        spannable3.setSpan(span3, 0, spannable3.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        spannable4.setSpan(span4, 0, spannable4.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
         
        SpannableStringBuilder spannable = new SpannableStringBuilder();
         
        spannable.append(spannable1);
        spannable.append("\n");
        spannable.append(spannable2);
        spannable.append("\n");
        spannable.append(spannable3);
        spannable.append("\n");
        spannable.append(spannable4);
         
        // 
        float ambient = 0.5f;
        float specular = 9.0f;
        float blurRadius = 3.0f;
        float[] direction = { 2.0f, 2.0f, 2.0f };
        EmbossMaskFilter filter = new EmbossMaskFilter(direction, ambient, specular, blurRadius);
        MaskFilterSpan span = new MaskFilterSpan(filter);
        SpannableString spannable5 = new SpannableString("Emboss");
        spannable5.setSpan(span, 0, spannable5.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
 
        spannable.append("\n");
        spannable.append(spannable5);
         
        // 
         
        ScaleXSpan span6 = new ScaleXSpan(2.0f);
        SpannableString spannable6 = new SpannableString("��������");
        spannable6.setSpan(span6, 0, spannable1.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        ScaleXSpan span7 = new ScaleXSpan(0.5f);
        SpannableString spannable7 = new SpannableString("�s�᤿��");
        spannable7.setSpan(span7, 0, spannable7.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        spannable.append("���֤�");
        spannable.append(spannable6);
        spannable.append(spannable7);
        spannable.append("�Ǥ��ޤ���");
         
        tv.setText(spannable);
        setContentView(tv, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
    } 
}