I have this working, but redundant, code:
feedbackView.text = SpannableStringBuilder()
.scale(.6f) { italic { append(getString(R.string.suggestion_prefix)) } }
.scale(.6f) { append("\n\n") }
.scale(.6f) { bold { append(s) } }
How would I refactor it so there is only one call to .scale()?
When I try this, only the first string is scaled:
feedbackView.text = SpannableStringBuilder()
.scale(.6f, { italic { append(getString(R.string.suggestion_prefix)) } })
.append("\n\n")
.bold { append(s) }
I have not been able to figure out the syntax to include everything in the lambda argument to scale().
You can put everything inside one scale lambda.
feedbackView.text = SpannableStringBuilder()
.scale(.6f) {
italic { append(getString(R.string.suggestion_prefix)) }
.append("\n\n")
.bold { append(s) }
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With