Predict the output
Which area turns red?
@Composable
fun Tag() {
Text("New",
Modifier
.padding(16.dp)
.background(Color.Red))
}Hint 1 of 1
Which modifier is the outer layer?
Choose an answer, then open Show answer below to check it.
Show answer
Answer: A Only the text area, inside the 16 dp padding
Correct. Padding is applied first (outside), then background paints what's inside it.
Why not the others?
- B The text plus the 16 dp padding. That's background before padding.
- C Nothing; background needs a shape. A rectangle is the default shape.
- D The whole screen. Nothing here fills the parent.