Android examples for Graphics:Spannable
get Compound Spannable Text
//package com.java2s; import android.text.Spannable; import android.text.SpannableString; import android.text.SpannableStringBuilder; import android.text.style.CharacterStyle; public class Main { public static Spannable getCompoundText(String str0, String str1, CharacterStyle style1) {/*from ww w .jav a 2 s. c o m*/ return getCompoundText(new String[] { str0, str1 }, new CharacterStyle[] { null, style1 }); } public static Spannable getCompoundText(String[] strs, CharacterStyle[] styles) { SpannableStringBuilder strTarget = new SpannableStringBuilder(); int len = strs.length; for (int i = 0; i < len; i++) { SpannableString str = new SpannableString(strs[i]); str.setSpan(styles[i], 0, str.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE); strTarget.append(str); } return strTarget; } }