Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Semper-Viventem
Created January 28, 2020 16:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Semper-Viventem/547468e97bcfe624d5686361f6db4871 to your computer and use it in GitHub Desktop.
Save Semper-Viventem/547468e97bcfe624d5686361f6db4871 to your computer and use it in GitHub Desktop.
private fun initSpannableText() {
val span = RoundedBackgroundColorSpan(
backgroundColor = colors.random(),
padding = dp(5),
radius = dp(5)
)
with(spanText) {
setShadowLayer(dp(10), 0f, 0f, 0) // it's important for padding working
text = androidx.core.text.buildSpannedString { inSpans(span) { append(text.toString()) } }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment