List of usage examples for android.text.style TextAppearanceSpan TextAppearanceSpan
public TextAppearanceSpan(String family, int style, int size, ColorStateList color, ColorStateList linkColor)
From source file:org.miaowo.miaowo.util.Html.java
private static void endFont(Editable text) { int len = text.length(); Font f = getLast(text, Font.class); int where = text.getSpanStart(f); text.removeSpan(f);/* w w w . j ava2 s . c o m*/ if (where != len) { if (!TextUtils.isEmpty(f.mColor)) { if (f.mColor.startsWith("@")) { Resources res = Resources.getSystem(); String name = f.mColor.substring(1); int colorRes = res.getIdentifier(name, "color", "android"); if (colorRes != 0) { ColorStateList colors = ResourcesCompat.getColorStateList(res, colorRes, null); text.setSpan(new TextAppearanceSpan(null, 0, 0, colors, null), where, len, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } } else { int c = Color.parseColor(f.mColor); if (c != -1) { text.setSpan(new ForegroundColorSpan(c | 0xFF000000), where, len, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } } } if (f.mFace != null) { text.setSpan(new TypefaceSpan(f.mFace), where, len, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } } }