Skip to content

Instantly share code, notes, and snippets.

@ammarques
Created March 26, 2015 19:20
Show Gist options
  • Save ammarques/31402368b0ab15716865 to your computer and use it in GitHub Desktop.
Save ammarques/31402368b0ab15716865 to your computer and use it in GitHub Desktop.
Different sizes in the same TextView while keep their style.
String text = "R$ 2.086,01"
String pathern = ",";
int start = text.lastIndexOf(pathern);
int end = ((text.length()) - start);
final SpannableString span = new SpannableString(text);
span.setSpan(new RelativeSizeSpan(0.5f), start, (start + end), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
someTextView.setText(span);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment