80,351
社区成员
发帖
与我相关
我的任务
分享
@Override
public void setText(CharSequence text, BufferType type) {
this.text = text;
if(text == null) {
super.setText(text);
return;
}
String face = BaseStringUtil.parseFaceString(text.toString());
Spanned span = Html.fromHtml(face, new Html.ImageGetter() {
@Override
public Drawable getDrawable(String source) {
Drawable drawable = null;
String sourceName = getContext().getPackageName() + ":drawable/"
+ source;
int id = getResources().getIdentifier(sourceName, null, null);
if (id != 0) {
drawable = getResources().getDrawable(id);
if (drawable != null) {
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(),
drawable.getIntrinsicHeight());
}
}
return drawable;
}
}, null);
super.setText(span, type);
}