TextView的SpannableString

展示一个多彩的TextView。

  SpannableString spannableString = new SpannableString(TextUtils.isNull(inviteCode) ? "邀请码" : "邀请码:" + inviteCode);
        ForegroundColorSpan colorSpan = new ForegroundColorSpan(Color.parseColor("#FF965A"));
        spannableString.setSpan(colorSpan, 4, spannableString.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
        tv_recommand_text.setText(spannableString);

你可能感兴趣的:(TextView的SpannableString)