Skip to content

Instantly share code, notes, and snippets.

@mochadwi
Last active April 22, 2019 15:59
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 mochadwi/b4b7340e24d9f6d46e6933584af900f0 to your computer and use it in GitHub Desktop.
Save mochadwi/b4b7340e24d9f6d46e6933584af900f0 to your computer and use it in GitHub Desktop.
Data Binding - Custom Spannable String
// fragment.xml
<TextView
app:largeText="@{`06.00`}"
app:smallText="@{`WIB`}"
/>
// TextBindingAdapter.kt
@BindingAdapter(value = ["largeText", "smallText"])
fun TextView.setCustomSize(largeText: String, smallText) {
// TODO: Use custom spannable here
largeText.setSpans(/*TODO: complete this argument*/)
smallText.setSpans(/*TODO: complete this argument*/)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment