2

How can I change the color of the card view elevation?

Or make it softer

It gets dark when I increase the app:cardElevation value

Daniel Ef
  • 73
  • 2
  • 8

2 Answers2

5

Add these 2 properties to your CardView

android:outlineAmbientShadowColor="@color/yourShadowColor"
android:outlineSpotShadowColor="@color/yourShadowColor"
Osama Remlawi
  • 2,356
  • 20
  • 21
1

here you can change color first you can make a drawable file and paste this code in it. then in your layout inside cardview, you can assign as background file.

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
    <shape>
        <corners android:bottomLeftRadius="8dp"
            android:topLeftRadius="5dp"
            android:bottomRightRadius="8dp"
            android:topRightRadius="5dp"/>
        <solid android:color="#ddd"/>
    </shape>
</item>
Adnan haider
  • 553
  • 8
  • 21