In my code below, I have a white view with an elevation of 8dp. The blue button has an elevation of 10dp so in theory it should show. However, it doesn't. It only shows the part in which it is not directly over the white view. I know it's something to with the elevation however I do not know exactly what. I have sussed out that it's fine when the white view is =<2, but as soon as I set it higher, the problem occurs.
Here is my code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<View
android:layout_width="match_parent"
android:layout_height="@dimen/login_background"
android:background="@color/colorPrimary" />
<View
android:id="@+id/view"
android:layout_width="@dimen/login_container_width"
android:layout_height="@dimen/login_container_height"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/login_container_margin_top"
android:background="@drawable/login_container"
android:elevation="8dp">
</View>
<Button
android:id="@+id/button"
android:layout_width="190dp"
android:layout_height="50dp"
android:layout_marginBottom="52dp"
android:background="@drawable/login_button"
android:elevation="10dp"
android:text="LOGIN"
android:textColor="@color/white"
android:textSize="20sp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" />
</RelativeLayout>
</LinearLayout>