I have the following String RM123.456. I would like to
- Make RM relatively smaller
- Make RM aligned to top exactly
I almost able to achieve it by using
spannableString.setSpan(new RelativeSizeSpan(0.50f), 0, index, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
textView.setText(spannableString, TextView.BufferType.SPANNABLE);
The outcome looks like
However, it is aligned to the bottom. It doesn't align to the top.
I try to use SuperscriptSpan
. It looks like
It doesn't do what I want as
SuperscriptSpan
doesn't make the text smaller. I'm not able to control its sizing.SuperscriptSpan
will make the text "over the top align"
May I know, how can I make RelativeSizeSpan align to top exactly?
This is what I wish to achieve.
Please note, we don't wish to go for 2 TextViews solution.
question from:https://stackoverflow.com/questions/36964034/how-to-make-relativesizespan-align-to-top