search

Home  >  Q&A  >  body text

android - IconMarginSpan text does not wrap. Use DynamicDrawableSpan and ImageSpan icons to have no margins.

IconMarginSpan has very few methods. Does the chooseHeight method have this effect? ​​How can I change it to set DynamicDrawableSpan#ALIGN_BASELINE like DynamicDrawableSpan and ImageSpan so that the following text can wrap?

public void chooseHeight(CharSequence text, int start, int end,
                             int istartv, int v,
                             Paint.FontMetricsInt fm) {
        if (end == ((Spanned) text).getSpanEnd(this)) {
            int ht = mBitmap.getHeight();

            int need = ht - (v + fm.descent - fm.ascent - istartv);
            if (need > 0)
                fm.descent += need;

            need = ht - (v + fm.bottom - fm.top - istartv);
            if (need > 0)
                fm.bottom += need;
        }
    }

Add a space. . . . . . That’s it

ringa_leeringa_lee2767 days ago1404

reply all(1)I'll reply

  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-24 11:40:14

    Add a space. . . . . . That’s it

    reply
    0
  • Cancelreply