title: Elevation in a View with transparent background
body: <p>I have a list of items with a custom background. The background is a simple shape with rounded-rect drawable filled with white color. So my view is similar to a Card. I can set an elevation on it and it works. There is a shadow beneath it.</p>
  
  <p>But I want to optimize it. My window's background is white, so I thought that I can remove View's background color to reduce overdraw. But it's not that simple. As soon as I set color to transparent in my view's background drawable, elevation stops working and shadow is not drawn anymore. I've tried to use stroke instead of solid color inside my view's bakcground drawable but it doesn't work too. It's probably because of a <code>ViewOutline</code>. So I've created a custom <code>OutlineProvider</code> that returns something like this:</p>
  
  <pre><code>outline.drawRoundRect(0,0,view.getWidth(), view.getHeight(), someRadius); 
  </code></pre>
  
  <p>Now my <code>View</code> has transparent background and shadow is also visible but there is something wrong with it. It does not look good. At the top of the <code>View</code> there is some sort of a background visible beneath it. Below is a picture of my output. On the left is a view with transparent background and a custom OutlineProvider. On the right is a view with opaque white background.</p>
  
  <p><a href="https://i.stack.imgur.com/H26zA.png" rel="noreferrer"><img src="https://i.stack.imgur.com/H26zA.png" alt="enter image description here"></a></p>
  
  <p>Is it a bug? Or is there another way to achieve this? It seems like it's a very simple performance optimization but it turns out that it's much more complicated than it should be.</p>