SpannableStringBuilder stringBuilder = new SpannableStringBuilder();
SpannableString string = new SpannableString("GFDTH");
//給textView設置顏色
stringBuilder.append(Html.fromHtml("<font color='#ff0000'>" + "恭喜"
+ "</font>" + "<font color='#00ff00'>" + "GFDTH" + "</font>"
+ "<font color='#0000ff'>" + "獲得了" + "</font>"));
//在textView裏手動添加圖片
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);
ImageSpan imageSpan = new ImageSpan(this, bitmap);
string.setSpan(imageSpan, 0, 5, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
代碼的鏈接:http://download.csdn.net/detail/how_old/9530407