Search This Blog

Friday, August 19, 2016

TextView - Đổi màu đoạn text trong chuỗi text

String str = "Tôi muốn format text";

// cắt chuổi
String[] str1 = str.split(" ");
textViewFomattext.setText(Html.fromHtml("<b>" + str1[0]+" "+str1[1] + "</b> " + "<font color=#ff0000><i>"+str1[2]+" "+str1[3]+"<i/><font/>"));

No comments:

Post a Comment