title: android:elevation doesn't work in L preview
body: <p>I've been playing with the L preview for a few days, and one thing that doesn't seem to work is the <code>android:elevation</code> attribute for a view. It works just fine when calling <code>View.setElevation()</code>, but it just seems to ignore the XML attribute. I'm using Android Studio 0.8.2 and have <code>minSdkVersion</code> and <code>targetSdkVersion</code> set to <code>'L'</code>, and <code>compileSdkVersion</code> set to <code>'android-L'</code>. <code>buildToolsVersion</code> is <code>"20.0.0"</code>. Here is a sample layout that doesn't work properly:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"&gt;
  
      &lt;android.support.v7.widget.CardView
          android:layout_width="match_parent"
          android:layout_height="0dp"
          android:layout_weight="1"
          android:layout_margin="10dp"
          android:elevation="5dp"&gt;
  
          &lt;TextView
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="top"/&gt;
  
      &lt;/android.support.v7.widget.CardView&gt;
  
      &lt;android.support.v7.widget.CardView
          android:layout_width="match_parent"
          android:layout_height="0dp"
          android:layout_weight="1"
          android:layout_margin="10dp"
          android:elevation="0dp"&gt;
  
          &lt;TextView
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="bottom"/&gt;
  
      &lt;/android.support.v7.widget.CardView&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Here is a screenshot of the result: imgur.com/mqeq9vK </p>
  
  <p>According to the <code>android:elevation</code> I set, the bottom card should be flat on the "ground", but it isn't. In fact, it looks no different than the top card who's elevation is <code>5dp</code>. Is this a known issue, and does it work for you? </p>
  
  <p>EDIT: It seems this is only the case with <code>CardView</code>, or at least it isn't an issue with <code>Buttons</code>. In this layout I replaced <code>CardView</code> with <code>Button</code>, and even though the shadow is kind of screwed up (known bug), you can still see the difference in elevation.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"&gt;
  
      &lt;Button
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:elevation="2dp"/&gt;
  
      &lt;Button
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:elevation="1dp"/&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>EDIT 2: It's pretty much confirmed that this issue only affects <code>CardView</code>, <code>android:elevation</code> works fine for any other view. For a detailed explanation of why this happens look at the accepted answer. In the meantime, my workaround is to replace the <code>CardView</code> with a <code>FrameLayout</code> and set <code>android:background</code> to a drawable. Here is an example of a card background drawable that works: </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"&gt;
      &lt;solid android:color="#fff" /&gt;
  &lt;/shape&gt;
  </code></pre>
  
  <p>I've also filed this as a bug, so please star this issue if it affects you. <a href="https://code.google.com/p/android-developer-preview/issues/detail?id=731" rel="nofollow noreferrer">https://code.google.com/p/android-developer-preview/issues/detail?id=731</a></p>