When trying out the new Android 5 elevation property, I found it failed to render in (what I think would be) a fairly common use case.

I had a ListView where each row was a RelativeLayout, that held a single LinearLayout child, then various Views within. The RelativeLayout had no background set, and used padding to separate each item from its neighbors. Within was a LinearLayout with a white background – it was this View that was supposed to have a system-supplied shadow via the elevation property. However, this was failing. When I added a rounded rectangle background, I noticed darkness at each corner – it turns out that the RelativeLayout was clipping the entire drawing canvas of the linear layout, including the shadow, because I was using padding. By switching to margin (on the LinearLayout child) instead of padding (on the RelativeLayout container), everything worked as expected.

I did not discover (or even see) these myself, but in searching (fruitlessly) for a fix to the issue described above, these 2 came up pretty often:

1. May fail when used on a background that is partially transparent.
2. May fail when used with CardViews.