我想在textview中添加ImageSpan,所有内容都可以使用此代码:
final SpannableStringBuilder sb = new SpannableStringBuilder();
MyAyehNumber Tag1 = new MyAyehNumber(My_Context, null);
Tag1.set_tagtitle(Title);
BitmapDrawable bd = (BitmapDrawable) convertViewToDrawable(Tag1);
int dWidth = bd.getIntrinsicWidth();
int dHeight = bd.getIntrinsicHeight();
bd.setBounds(0,0, dWidth,dHeight);
ImageSpan mImageSpan= new ImageSpan(bd);
sb.append(contactName);
sb.setSpan(mImageSpan, sb.length()-(contactName.length()), sb.length(),Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
Txt_Ayeh.append(sb);
但是当我为Textview设置android:lineSpacingExtra时... ImageSpan位于文本下方! 如何设置界限居中? TNX