This project implements a reproducable case for a bug report I created for Android Studio.
Andriod studio renders a custom textview which adds MetricAffectingSpans to the text it is given via setText(CharSequence, BufferType)
with correct wrapping and no clipping/truncating.
Andriod Studio's layout preview incorrectly inserts line breaks into the text when rendering the custom text views.
These screenshots show several instances of MyTextView
:
- Half the text is rendered with a
ForegroundColorSpan
(non-metric affecting, works fine in the android studio preview. - Half the text with a monospace
TypefaceSpan
(metric affecting, incorrect in preview) - Half the text with an
AbsoluteSizeSpan
(metric affecting, incorrect in preview) - Half the text with a
RelativeSizeSpan
(metric affecting, incorrect in preview) - Half the text with a
ScaleXSpan
(metric affecting, incorrect in preview) - Half the text with a
SubscriptSpan
(metric affecting, incorrect in preview) - Half the text with a
SuperscriptSpan
(metric affecting, incorrect in preview)
![android studio preview](android studio screenshot.png)
![device screenshot](device screenshot.png)