【发布时间】:2012-02-17 12:40:11
【问题描述】:
您好,我正在开发聊天应用程序,我想在其中插入笑脸 我不太了解如何在其中集成和显示 你能给我做同样的建议吗?
ImageGetter imageGetter = new ImageGetter() {
public Drawable getDrawable(String source) {
Drawable d = getResources().getDrawable(
R.drawable.happy);
d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
return d;
}
};
cs = Html.fromHtml(
"<img src='"
+ getResources()
.getDrawable(R.drawable.happy)
+ "'/>", imageGetter, null);
System.out.println("cs is:- " + cs);
edttxtemoji.setText(cs);
我找到了这段代码,它使用了图像,这可行吗? 还是有其他解决方案? 请提前给我更好的解决方案
【问题讨论】:
-
查看使用 ImageSpan 和 EditText 的解决方案:stackoverflow.com/questions/19534427/…
标签: android chat android-edittext