Android elevation not showing shadow on Button
<h2>Can't get button shadows to show up.</h2>
<p>Stripped down my code to the minimal example:</p>
<p><strong>activity_main.xml</strong></p>
<pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;ScrollView xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
    xmlns:tools=&quot;http://schemas.android.com/tools&quot;
    android:layout_width=&quot;match_parent&quot;
    android:layout_height=&quot;match_parent&quot;&gt;

    &lt;LinearLayout
        android:id=&quot;@+id/main_layout&quot;
        android:layout_width=&quot;wrap_content&quot;
        android:layout_height=&quot;wrap_content&quot;&gt;

        &lt;RelativeLayout
            android:layout_width=&quot;match_parent&quot;
            android:layout_height=&quot;match_parent&quot;
            android:layout_marginTop=&quot;10dp&quot;
            android:layout_marginLeft=&quot;10dp&quot;&gt;

            &lt;Button
                android:id=&quot;@+id/my_button&quot;
                android:layout_width=&quot;wrap_content&quot;
                android:layout_height=&quot;wrap_content&quot;
                android:layout_centerHorizontal=&quot;true&quot;
                android:layout_marginLeft=&quot;20dp&quot;
                android:elevation=&quot;10dp&quot;
                android:translationZ=&quot;10dp&quot;
                android:background=&quot;@android:color/holo_green_light&quot;
                android:text=&quot;BUTTON&quot;/&gt;

        &lt;/RelativeLayout&gt;

    &lt;/LinearLayout&gt;

&lt;/ScrollView&gt;
</code></pre>
<p>I need that layout structure.</p>
<p><strong>MainActivity.java</strong></p>
<pre><code>public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

}
</code></pre>
<p>Shadows is visible in Android Studio designer:</p>
<p><a href="https://i.stack.imgur.com/xfQMY.png" rel="noreferrer"><img src="https://i.stack.imgur.com/xfQMY.png" alt="enter image description here" /></a></p>
<p>But not shown at runtime:</p>
<p><a href="https://i.stack.imgur.com/qnGeC.png" rel="noreferrer"><img src="https://i.stack.imgur.com/qnGeC.png" alt="enter image description here" /></a></p>
<p>Tested on:</p>
<ul>
<li>Genymotion Google Nexus 5X - Marshmallow 6.0.0 - API 23</li>
<li>Genymotion Google Nexus 5 - Lollipop 5.1.0 - API 22</li>
<li>Genymotion Samsung Galaxy S2 - Jelly Bean 4.1.1 - API 16</li>
<li>Hardware device, Samsung Galaxy S5 mini - KitKat 4.4.2 - API 19</li>
</ul>
<p>All same result.</p>
<p>I'm using:</p>
<ul>
<li>Android Studio 2.1.2</li>
<li>minSdkVersion 16</li>
<li>targetSdkVersion 24</li>
</ul>
<p>Please create a new project in Andriod Studio, Empty Activity template, then copy and paste that code into <code>activity_main.xml</code> and <code>MainActivity.java</code> so you can test and tell me.</p>