I am trying to set span on a SpannableStringBuilder using flag SPAN_EXCLUSIVE_EXCLUSIVE and I am facing problem on further editing the text to which I am setting span.
Expected behaviour 1: Original text. 2: Text added before. 3: Text added after with space.
Unexpected Behaviour on adding text after styled text
I don't want the added text to be styled, and want to know what am I doing wrong.
EDIT 1: The issue is happening on Moto X Play, but is not reproduced on Nexus 5X. Still testing on other devices.
You just probably add text not the way you should. Use
.insert()
and.append()
methods of SpannableStringBuilder to add additional text.I just tried what you try to achieve and here is the result:
Result: Nexus 7 Emulator running MainActivity with this code