4

Started learning Jetpack Compose. An error occurred: Type mismatch: inferred type is Dp but CardElevation was expected, I can't understand what the problem is, tell me how to solve it. enter image description here

import androidx.compose.ui.unit.dp library imported, and updated versions of Jetpack Compose, expected to help

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841

1 Answers1

6

If you are using Material 3, then you need to use CardElevation in this way:

elevation = CardDefaults.cardElevation(defaultElevation = 5.dp) 

More details here

Code Poet
  • 6,222
  • 2
  • 29
  • 50