Translate text by top

We were centralizing without considering that there could be some
additional translation passed to DynamicDrawableSpan#draw

Test: atest DynamicDrawableSpanTest
Fixes: 154489406
Change-Id: I9615f478d1962b2d6fd54123fc391554073f5bf1
This commit is contained in:
Lucas Dupin
2020-04-21 16:35:50 -07:00
parent 8208ca5d05
commit 798562bfbd

View File

@@ -166,7 +166,7 @@ public abstract class DynamicDrawableSpan extends ReplacementSpan {
if (mVerticalAlignment == ALIGN_BASELINE) {
transY -= paint.getFontMetricsInt().descent;
} else if (mVerticalAlignment == ALIGN_CENTER) {
transY = (bottom - top) / 2 - b.getBounds().height() / 2;
transY = top + (bottom - top) / 2 - b.getBounds().height() / 2;
}
canvas.translate(x, transY);