Background color

Report a typo

Fill the missing lines, so that the code will produce the same output as in the picture.

Text yellow in yellow background

Fill in the gaps with the relevant elements
val text = "Background will be in yellow color"
val spanText = SpannableString(text)

val startOfSpan = 
val endOfSpan = 
val color = Color.YELLOW

val span = (color)
spanText.setSpan(span, , , Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)

binding.spanTextView.text = spanText

Create a free account to access the full topic