This question was asked on SO many times, but still I didn't find a good solution for this problem.
Why do I need this to do? Well because project me and my team develops has iOS style.
What did I try?
So is there a way to change shadow color of CardView with minimum edits of all layout files and with drawing shadow outside of the view like original CardView does?
Consider this thread in twitter, where Nick Butcher talks about how to implement the feature:
See outlineAmbientShadowColor
, outlineSpotShadowColor
, spotShadowAlpha
and ambientShadowAlpha
attributes for details. Unfortunately, that's possible from API 28 onwards.
For lower APIs Nick has shared a gist. Here's the result:
Running on API 21
This technique isn't directly connected to CardView
, it can be applied to any View
.