두가지 방법이 있습니다.
1. html 태그를 이용하는 방법.
- java
String first = "This word is ";
String next = "<font color='#EE0000'>red</font>";
t.setText(Html.fromHtml(first + next));
- xml
<string name="inputText">
<![CDATA[
<p>The value of input is <font color='#00ff00'>positive</font> now.</p>
]]>
</string>
2. SpannableString을 이용하는 방법
SpannableString text = new SpannableString("Lorem ipsum dolor sit amet");
// make "Lorem" (characters 0 to 5) red
text.setSpan(new ForegroundColorSpan(Color.RED), 0, 5, 0);
textView.setText(text, BufferType.SPANNABLE);