Modifier.padding requires a Dp value like 12.dp, not just 12.
Step 2: Validate other parts
Text inside Card is valid, Modifier.padding works with Card, and background color is optional.
Final Answer:
Missing .dp unit for padding value -> Option B
Quick Check:
Modifier.padding needs .dp unit = B [OK]
Hint: Always add .dp after numeric padding values [OK]
Common Mistakes:
Omitting .dp unit causes compile error
Thinking Card needs background color always
Believing Text can't be child of Card
5. You want to create a Card that has rounded corners, a shadow, and changes background color when clicked. Which approach correctly combines these features?
hard
A. Use Card with elevation for corners, shape for shadow, and no clickable modifier
B. Use Card with padding for shadow, shape for color, and clickable for corners
C. Use Card with background color parameter only and add shadow manually
D. Use Card with shape = RoundedCornerShape(12.dp), elevation = 8.dp, and clickable modifier with background color change inside
Step 2: Combine clickable with background color change
Clickable modifier can be used with state to change background color on click inside Card content.
Step 3: Evaluate options
Use Card with shape = RoundedCornerShape(12.dp), elevation = 8.dp, and clickable modifier with background color change inside correctly uses shape, elevation, and clickable with background color change. Others misuse parameters or miss features.
Final Answer:
Use Card with shape = RoundedCornerShape(12.dp), elevation = 8.dp, and clickable modifier with background color change inside -> Option D
Quick Check:
Shape + elevation + clickable for color change = A [OK]
Hint: Combine shape, elevation, and clickable modifier for interactive Card [OK]
Common Mistakes:
Confusing elevation with padding for shadow
Misusing shape for background color
Forgetting clickable modifier for interaction
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.