androidandroid-jetpack-composeandroid-compose-cardandroid-jetpack-compose-surface

Whats the difference between Surface and Card in Jetpack Compose?


It's basically the same right? They have the same properties. I really don't know when I have to use each.

Technically Cards is for a Card view but Surface have the same properties like elevation and border


Solution

  • If you look at Card composable source you will understand that card is a surface with default elevation and, the background shape is MaterialTheme.shapes.medium

    as the documentation "Cards are Surfaces that display content and actions on a single topic."