Skip to content

Instantly share code, notes, and snippets.

@tokudu
Last active November 21, 2016 11:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tokudu/82523b1bd33b8880e5c2 to your computer and use it in GitHub Desktop.
Save tokudu/82523b1bd33b8880e5c2 to your computer and use it in GitHub Desktop.
BackgroundColorSpan Example
String str = "Some really long string goes in here";
Spannable spannable = new SpannableString(str);
spannable.setSpan(new BackgroundColorSpan(
getResources().getColor(android.R.color.black)
), 0, str.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
yourTextView.setText(spannable);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment