When textAllCaps is set TextView applies TransformationMethod that takes the text and converting it to plain Strings that makes source text CharSequence loose all other stylings and spans.
You can trick it programatically like (Kotlin naive):
val text = textView.text // at this point allCaps is applied so text is caps
textView.setAllCaps(false) // remove the allCaps
val spannable = SpannableString(text) // create new spannable with allCapped text
spannable.setSpan(RelativeSizeSpan(1f), 0, text.length, SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE)
textView.text = spannable //set it.
Another approach is creating your own TransformationMethod that will apply your Span for every text that is set.
Probably a bug or mutual exclusion.
When
textAllCaps
is setTextView
appliesTransformationMethod
that takes the text and converting it to plainStrings
that makes source textCharSequence
loose all other stylings and spans.You can trick it programatically like (Kotlin naive):
Another approach is creating your own
TransformationMethod
that will apply your Span for every text that is set.