I'm working on a dark theme for my app, and everything's working fine, except for the CardView that completely loses its elevation after setting dark mode.
My CardView:
<com.google.android.material.card.MaterialCardView
android:id="@+id/cvTestType"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
app:cardCornerRadius="5dp"
app:cardElevation="10dp">
<TextView
android:id="@+id/tvTestType"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textStyle="bold"
android:textSize="15sp" />
</com.google.android.material.card.MaterialCardView>
App Theme:
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar">
</style>
This is how CardView looks with normal light theme:
As you can see, not only CardView, but also ActionBar both shows elevation correctly.
This is how screen looks like in dark mode:
Here CardView and ActionBar, both loose elevation effect completely.
I've tried the suggestions in this: android-dark-mode-elevation-not-changing-surface-color
and this: https://github.com/android/user-interface-samples/issues/150
and others to no avail.
What can I try next?

