Code example for ImageSpan

0
	 
	@Override 
	public SpannableString getSpannableString() {
		mDrawable.setBounds(0, 0, 100, 100); // 插入的图片的大小,需要改成动态适应屏幕宽度。
		SpannableString imageSpannableString = new SpannableString(getRawTextString());
		ImageSpan imageSpan = new ImageSpan(mDrawable, DynamicDrawableSpan.ALIGN_BASELINE);
		imageSpannableString.setSpan(imageSpan, 0, imageSpannableString.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
		return imageSpannableString;
	} 
	 
 
	private void init() { 
		mImageName = UUID.randomUUID().toString();
	} 
 
}