android - Elevation does not show the shadow

0

Good morning friends, I'm having a layout problem. I put elevation but the shadow does not appear in the component, does anyone know what it can be?

Below is my layout:

<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>

I designed the component with a rounded border, I'll put here also to make it 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>
    
asked by anonymous 02.05.2017 / 22:37

1 answer

0

Put this parameter in the LinearLayout that is outside the RelativeLayout that has the elevation.

android:clipToPadding="false"
    
03.05.2017 / 03:22