I use ImageSpan to display image in textview. The TextView is sinlgline with end ellipsize. When image is in the end of textview and there is not enought space for it. I thi
I use TextUtils.ellipsize for the text before setting it into TextView.
CharSequence cs = TextUtils.ellipsize(s, textView.getPaint(), textView.getWidth() - textView.getPaddingRight() - textView.getPaddingLeft(), TextUtils.TruncateAt.END);
textView.setText(cs);
if textview set wrap_content or match_parent,you had better call TextUtils.ellipsize in textview.post();
tv.post(new Runnable() {
@Override
public void run() {
tv.setText(TextUtils.ellipsize(tv.getText(), (TextPaint) tv.getPaint(), tv.getWidth() - tv.getPaddingRight() - tv.getPaddingLeft(), TextUtils.TruncateAt.END));
}
});