I did this a little simpler by making the cardBackgroundColor
green and contentPadding
1dp
and inside the card having a ConstraintLayout
(or other layout) with a white background, like this:
...
This way no extra xml or other superfluous code is needed.
Result: