diff options
| author | 2020-04-21 16:35:50 -0700 | |
|---|---|---|
| committer | 2020-04-21 16:42:27 -0700 | |
| commit | 798562bfbded2adce6c59ed5de065aee8ae97475 (patch) | |
| tree | 51b7901325851745bf9079aa8f6f04f629134973 | |
| parent | 8208ca5d05703293d73e6a3cf58a1e648622be36 (diff) | |
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
| -rw-r--r-- | core/java/android/text/style/DynamicDrawableSpan.java | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/java/android/text/style/DynamicDrawableSpan.java b/core/java/android/text/style/DynamicDrawableSpan.java index f37e4238a1c6..d6d99f846e16 100644 --- a/core/java/android/text/style/DynamicDrawableSpan.java +++ b/core/java/android/text/style/DynamicDrawableSpan.java @@ -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); |