Daniel Ef
Daniel Ef

Reputation: 75

Change Card View Elevation Color

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

Upvotes: 2

Views: 5710

Answers (2)

Osama Remlawi
Osama Remlawi

Reputation: 2990

Add these 2 properties to your CardView

android:outlineAmbientShadowColor="@color/yourShadowColor"
android:outlineSpotShadowColor="@color/yourShadowColor"

Upvotes: 5

Adnan haider
Adnan haider

Reputation: 553

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>

Upvotes: 1

Related Questions