Java Code Examples for android.text.style.DynamicDrawableSpan#ALIGN_BOTTOM
The following examples show how to use
android.text.style.DynamicDrawableSpan#ALIGN_BOTTOM .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CenteredImageSpan.java From GSYRickText with MIT License | 6 votes |
@Override public void draw(Canvas canvas, CharSequence text, int start, int end, float x, int top, int y, int bottom, Paint paint) { if (mVerticalAlignment == DynamicDrawableSpan.ALIGN_BASELINE || mVerticalAlignment == DynamicDrawableSpan.ALIGN_BOTTOM) { super.draw(canvas, text, start, end, x, top, y, bottom, paint); return; } Drawable b = getDrawable(); canvas.save(); int transY = 0; //获得将要显示的文本高度-图片高度除2等居中位置+top(换行情况) transY = ((bottom - top) - b.getBounds().bottom) / 2 + top; //偏移画布后开始绘制 canvas.translate(x, transY); b.draw(canvas); canvas.restore(); }
Example 2
Source File: BetterImageSpan.java From fresco with MIT License | 5 votes |
/** * A helper function to allow dropping in BetterImageSpan as a replacement to ImageSpan, and * allowing for center alignment if passed in. */ public static final @BetterImageSpanAlignment int normalizeAlignment(int alignment) { switch (alignment) { case DynamicDrawableSpan.ALIGN_BOTTOM: return ALIGN_BOTTOM; case ALIGN_CENTER: return ALIGN_CENTER; case DynamicDrawableSpan.ALIGN_BASELINE: default: return ALIGN_BASELINE; } }
Example 3
Source File: VisibleRecipientChip.java From talk-android with MIT License | 4 votes |
public VisibleRecipientChip(final Drawable drawable, final RecipientEntry entry) { this(drawable, entry, DynamicDrawableSpan.ALIGN_BOTTOM); }
Example 4
Source File: Emoji.java From Game-of-Thrones with Apache License 2.0 | 4 votes |
public EmojiSpan(EmojiDrawable d) { super(d, DynamicDrawableSpan.ALIGN_BOTTOM); }
Example 5
Source File: VisibleRecipientChip.java From ChipsLibrary with Apache License 2.0 | 4 votes |
public VisibleRecipientChip(final Drawable drawable, final RecipientEntry entry) { super(drawable, DynamicDrawableSpan.ALIGN_BOTTOM); mDelegate = new SimpleRecipientChip(entry); }