I'm using SpannableStringBuilder to set a string partially with a style of bold, however it's not working and I am unsure of what I am doing incorrectly.
String normalText = "New Here? ";
String boldText = "Register";
SpannableStringBuilder str = new SpannableStringBuilder(normalText + boldText);
tr.setSpan(new StyleSpan(Typeface.BOLD), normalText.length(), str.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
mBtnRegister.setText(str);
I've followed this SO example:
The specified code looks to be working well as visible in the screenshot here: https://i.sstatic.net/MZX7G.jpg
Please check your code for other mistakes causing wrong behavior.