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.