textView.setText(Html.fromHtml(imageString, new OrImageGetter(getContext(), textView, 108, 45), null));
重写OrImageGetter
public class OrImageGetter implements Html.ImageGetter {
private DkDrawable mOrDrawable = null;
private TextView mTargetTextView;
private Context mContext;
private int mWidth;
private int mHeight;
public OrImageGetter(Context context, TextView targetTextView, int width, int height) {
this(context, targetTextView);
this.mWidth = width;
this.mHeight = height;
}
public DkImageGetter(Context context, TextView targetTextView) {
this.mTargetTextView = targetTextView;
this.mContext = context;
}
@Override
public Drawable getDrawable(final String source) {
mOrDrawable = new OrDrawable();
Glide.with(mContext)
.load(source)
.asBitmap()
.fitCenter()