我正在做一个小项目,它发送带有情感图标的消息。我使用以下函数将图像转换为 spannble 字符串以将情感图标作为文本发送,但问题是接收者无法在他的消息上看到情感图标,而不是接收者看到的情感图标 [ H]????
public SpannableStringBuilder addSmily(int position){
Drawable happySmileys = mContext.getResources().getDrawable(mThumbIds[position]);
happySmileys .setBounds(0, 0, happySmileys.getIntrinsicWidth(), happySmileys.getIntrinsicHeight());
/*Drawable sadSmiley = this.getResources().getDrawable(R.drawable.progress_4);
sadSmiley .setBounds(0, 0, sadSmiley.getIntrinsicWidth(), sadSmiley.getIntrinsicHeight());*/
SpannableStringBuilder builder = new SpannableStringBuilder();
builder.append("[h]");
builder.setSpan(new ImageSpan(happySmileys), builder.length()-"[h]".length(), builder.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
return builder;
}
感谢您阅读我的问题。有什么建议吗??