Class ImageSpan

All Implemented Interfaces:
UpdateAppearance, UpdateLayout

public class ImageSpan extends DynamicDrawableSpan
Span that replaces the text it's attached to with a Drawable that can be aligned with the bottom or with the baseline of the surrounding text. The drawable can be constructed from varied sources: The default value for the vertical alignment is DynamicDrawableSpan.ALIGN_BOTTOM

For example, an ImagedSpan can be used like this:

 SpannableString string = new SpannableString("Bottom: span.\nBaseline: span.");
 // using the default alignment: ALIGN_BOTTOM
 string.setSpan(new ImageSpan(this, R.mipmap.ic_launcher), 7, 8, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
 string.setSpan(new ImageSpan(this, R.mipmap.ic_launcher, DynamicDrawableSpan.ALIGN_BASELINE),
 22, 23, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
 
Text with ImageSpans aligned bottom and baseline.