title.setText("Your big island <b>ADVENTURE!</b>";
我知道上面的代码是不正确的,但它有助于说明我想要实现的目标。我该怎么做?
梦里花落0921
浏览 605回答 3
3回答
慕莱坞森
使用跨度。例:final SpannableStringBuilder sb = new SpannableStringBuilder("your text here");// Span to set text color to some RGB valuefinal ForegroundColorSpan fcs = new ForegroundColorSpan(Color.rgb(158, 158, 158)); // Span to make text boldfinal StyleSpan bss = new StyleSpan(android.graphics.Typeface.BOLD); // Set the text color for first 4 characterssb.setSpan(fcs, 0, 4, Spannable.SPAN_INCLUSIVE_INCLUSIVE); // make them also boldsb.setSpan(bss, 0, 4, Spannable.SPAN_INCLUSIVE_INCLUSIVE); yourTextView.setText(sb);