1. Calculate the text size String timeStr = ""; int textWidth = (int) Layout. getDesiredWidth (timeStr, 0, timeStr. length (), tp); 2. Bold TextPaint tp = text. getPaint (); tp. setFakeBoldText (true); 3. Underline String str = "underline"; SpannableStringBuilder spannable = new SpannableStringBuilder (str); CharacterStyle span = new UnderlineSpan (); spannable. setSpan (span, start, end, Spannable. SPAN_EXCLUSIVE_EXCLUSIVE); text. setText (spannable); 4. SpannableStringBuilder style_title = new SpannableStringBuilder (titleStr); ForegroundColorSpan span = new ForegroundColorSpan (context. getResources (). getColor (R. color. today_address) style_title.setSpan (span, start, end, Spannable. (Optional); 5. Different SpannableStringBuilder style_title = new character (titleStr); AbsoluteSizeSpan span_2 = new AbsoluteSizeSpan (12); // font size (span_2, start, end, Spannable. SPAN_EXCLUSIVE_EXCLUSIVE); 6. Add the strikethrough SpannableString ss = new SpannableString (B. title); ss. setSpan (new StrikethroughSpan (), start, end, Spanned. SPAN_EXCLUSIVE_EXCLUSIVE); 7. To add images, use the SpannableString and ImageSpan classes: Drawable drawable = getResources (). getDrawable (id); drawable. setBounds (0, 0, drawable. getIntrinsicWidth (), drawable. getIntrinsicHeight (); // The text to be processed. [smile] is the text to be replaced by SpannableString spannable = new SpannableString (getText (). toString () + "[smile]"); // you must use ImageSpan span = new ImageSpan (drawable, ImageSpan. ALIGN_BASELINE); // start to replace. Note that parameters 2nd and 3rd indicate where to replace and where to replace (start and end) // The last parameter is similar to a set in mathematics, [5, 12) indicates from 5 to 12, including 5 but not 12 spannable. setSpan (span, getText (). length (), getText (). length () + "[smile]". length (), Spannable. SPAN_INCLUSIVE_EXCLUSIVE); setText (spannable );