先预览一下效果
源码地址:https://github.com/heinika/SimpleChatUI
先定义一个包含反射的ImageGettter
/**
* 用于解析富文本中的表情图片
*/
mImageGetter = new Html.ImageGetter() {
@Override
public Drawable getDrawable(String source) {
Class clazz = R.mipmap.class;
try {
Field field = clazz.getDeclaredField(source);
int sourceId = field.getInt(field);
Drawable drawable = getResources().getDrawable(sourceId);
drawable.setBounds(0,