private void setImageText()
{
//根据ID获取图像的Bitmap对象
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);
//创建imageSpan对象
ImageSpan imageSpan = new ImageSpan(this, bitmap);
//创建一个SpannableString对imageSpan进行封装
SpannableString spannableString = new SpannableString("icon哇咔咔");
//用ImageSpan对象替换icon
spannableString.setSpan(imageSpan, 0, 4, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
tv_hello.setText(spannableString);
}
转载于:https://www.cnblogs.com/tqj-zyy/archive/2013/05/12/4559784.html