I am using a cardview as the root of a custom view I am writing. I using the v7 support library. My XML looks like this:
I might be late in the game, but I had the same issue. Just wanted to share a simple solution!
My custom view extended a CardView and I had a margin applied to the root element (i.e. CardView) in the XML just like in the original question. This ended up giving me the extra white border like this:
Solution was to move the margin from root of the Custom View XML to the declaration of your custom view (check comments in the snippet)
Code snippet:
app:cardElevation="@dimen/default_card_elevation">
.
.
.
Ended up just moving over the margin to my custom view declaration which got rid of the extra white border:
cv:pt_widgetColor="@color/colorAccent" />
After the change, much cleaner :) :