Skip to content

cheatsheet

Android Textview Spannable Cheat Sheet

Note that this cheat sheet will explain everything using text.setSpan. The code that around this should resemble something like this. val text = SpannableString(“Hello World”) text.setSpan(…) textview.setText(text, TextView.BufferType.SPANNABLE) Bold text.setSpan( StyleSpan(android.graphics.Typeface.BOLD), 0, 3, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE ) Italic text.setSpan( StyleSpan(android.graphics.Typeface.ITALIC), 0, 3, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE ) Bold Italic text.setSpan(… Read More »Android Textview Spannable Cheat Sheet