0
Despite defining the elevation
us RelativeLayout
s, the shadow does not appear in the component. What can be?
Below is my layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/activity_cadastro_produto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff"
android:clipToPadding="false"
tools:context=".MainActivity">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="15dp"
android:orientation="vertical">
<ImageView
android:id="@+id/imageView"
android:layout_width="180dp"
android:layout_height="70dp"
android:layout_marginLeft="-13dp"
android:layout_weight="1"
app:srcCompat="@drawable/logo" />
<TextView
android:id="@+id/txtwelcome"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:text="OLÁ FULANO!"
android:textColor="@android:color/holo_red_dark"
android:textSize="16sp" />
<TextView
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Nossos serviços, disponíveis para você:"
android:textSize="13sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="15dp"
android:clipToPadding="false">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="5"
android:orientation="horizontal"
android:weightSum="10">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp"
android:layout_marginTop="3dp"
android:layout_weight="5"
android:background="@drawable/main_rounded"
android:elevation="3dp">
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp"
android:layout_marginTop="3dp"
android:layout_weight="5"
android:background="@drawable/main_rounded"
android:elevation="3dp">
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:orientation="horizontal"
android:weightSum="10">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="5">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="160dp"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp"
android:layout_marginTop="3dp"
android:layout_weight="5"
android:background="@drawable/main_rounded"
android:elevation="3dp">
</RelativeLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="5"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="5dp"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp"
android:layout_marginTop="3dp"
android:layout_weight="5"
android:background="@drawable/main_rounded"
android:elevation="3dp">
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp"
android:layout_marginTop="8dp"
android:layout_weight="5"
android:background="@drawable/main_rounded"
android:elevation="3dp">
</RelativeLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="5"
android:orientation="horizontal"
android:weightSum="10">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp"
android:layout_marginTop="3dp"
android:layout_weight="5"
android:background="@drawable/main_rounded"
android:elevation="3dp">
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp"
android:layout_marginTop="3dp"
android:layout_weight="5"
android:background="@drawable/main_rounded"
android:elevation="3dp">
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
I designed the component with rounded edge, I will put here also to be easy to replicate:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:radius="3dp"/>
<solid android:color="@android:color/transparent"/>
<stroke android:color="#696969" android:width="1dp"></stroke>
</shape>
</item>
</selector>