FileDocCategorySizeDatePackage
IconMarginSpan.javaAPI DocAndroid 5.1 API2238Thu Mar 12 22:22:10 GMT 2015android.text.style

IconMarginSpan

public class IconMarginSpan extends Object implements LeadingMarginSpan, LineHeightSpan

Fields Summary
private android.graphics.Bitmap
mBitmap
private int
mPad
Constructors Summary
public IconMarginSpan(android.graphics.Bitmap b)

        mBitmap = b;
    
public IconMarginSpan(android.graphics.Bitmap b, int pad)

        mBitmap = b;
        mPad = pad;
    
Methods Summary
public voidchooseHeight(java.lang.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;
        }
    
public voiddrawLeadingMargin(android.graphics.Canvas c, android.graphics.Paint p, int x, int dir, int top, int baseline, int bottom, java.lang.CharSequence text, int start, int end, boolean first, android.text.Layout layout)

        int st = ((Spanned) text).getSpanStart(this);
        int itop = layout.getLineTop(layout.getLineForOffset(st));

        if (dir < 0)
            x -= mBitmap.getWidth();

        c.drawBitmap(mBitmap, x, itop, p);
    
public intgetLeadingMargin(boolean first)

        return mBitmap.getWidth() + mPad;