0

Eu gostaria de adicionar um efeito shadow que resulta-se em um ressalto da tela, igual este abaixo:

Imagem do google:

Google

Código

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:background="@color/gray">


    <FrameLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <ImageView
            android:id="@+id/imageView_header_book"
            android:layout_width= "match_parent"
            android:layout_height="84dp"
            android:layout_marginBottom="410dp"
            android:scaleType="fitXY"
            android:src="@drawable/header_book"/>

        <TextView
            android:id="@+id/custom_view_loja"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="25dp"
            android:gravity="center_horizontal|center_vertical"
            android:maxLines="1"
            android:textColor="@color/white"
            android:textSize="@dimen/overlay_loja"
            android:textStyle="bold"
            android:shadowColor="@color/black"
            android:shadowDx="1"
            android:shadowDy="1"
            android:shadowRadius="2"/>

        <TextView
            android:id="@+id/custom_view_shopping"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="40dp"
            android:gravity="center_horizontal|center_vertical"
            android:shadowColor="@color/black"
            android:shadowDx="1"
            android:shadowDy="1"
            android:shadowRadius="2"
            android:maxLines="1"
            android:textColor="@color/white"
            android:textSize="@dimen/overlay_shopping" />

        <TextView
            android:id="@+id/custom_view_competencia"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="71dp"
            android:gravity="center_horizontal|center_vertical"
            android:maxLines="1"
            android:textColor="@color/white"
            android:textSize="@dimen/overlay_competencia"
            android:shadowColor="@color/black"
            android:shadowDx="1"
            android:shadowDy="1"
            android:shadowRadius="2"/>
    </FrameLayout>

    <LinearLayout
        android:id="@+id/custom_view_information_container"
        android:layout_width="match_parent"
        android:layout_height="400dp"
        android:orientation="vertical">

        <LinearLayout
            android:id="@+id/custom_view_book_horizontal"
            android:layout_width="match_parent"
            android:layout_height="400dp"
            android:orientation="horizontal" >

            <LinearLayout
                android:id="@+id/custom_view_book_text_data"
                android:layout_width="match_parent"
                android:layout_height="400dp"
                android:orientation="vertical">

                <FrameLayout
                    android:layout_width="245dp"
                    android:layout_height="60dp"
                    android:layout_gravity="center_vertical|center_horizontal"
                    android:layout_marginTop="88dp"
                    android:background="@color/white">

                    <ImageView
                        android:id="@+id/imageView_aluguel_shopping"
                        android:layout_width="50dp"
                        android:layout_height="50dp"
                        android:layout_gravity="left"
                        android:layout_marginLeft="15dp"
                        android:layout_marginTop="6dp"
                        android:src="@drawable/aluguel_shopping" />

                    <TextView
                        android:id="@+id/textView_aluguel_icon_title"
                        android:layout_width="wrap_content"
                        android:layout_height="14dp"
                        android:layout_gravity="left"
                        android:layout_marginLeft="75dp"
                        android:layout_marginTop="17dp"
                        android:gravity="left"
                        android:text="Aluguel"
                        android:textColor="@color/black"
                        android:textSize="@dimen/overlay_aluguel_icon"
                        android:textStyle="bold" />

                    <TextView
                        android:id="@+id/custom_view_valor_aluguel"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentBottom="true"
                        android:layout_gravity="left"
                        android:layout_marginLeft="73dp"
                        android:layout_marginTop="30dp"
                        android:gravity="left"
                        android:maxLines="1"
                        android:textColor="@color/green_aliansce"
                        android:textSize="@dimen/overlay_valorAluguel" />

                    <ImageView
                        android:id="@+id/imageView_aluguel_mensal_icon"
                        android:layout_width="10dp"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal|center_vertical"
                        android:layout_marginBottom="6dp"
                        android:layout_marginLeft="32dp"
                        android:src="@android:drawable/presence_online" />

                    <TextView
                        android:id="@+id/textView_aluguel_mensal_icon_title"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="right"
                        android:layout_marginTop="18.5dp"
                        android:layout_marginRight="60dp"
                        android:gravity="right"
                        android:text="Mensal"
                        android:textColor="@color/black"
                        android:textSize="8dp"
                        android:textStyle="bold" />

                    <TextView
                        android:id="@+id/custom_view_valor_aluguelMensal"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="right"
                        android:layout_marginTop="28dp"
                        android:layout_marginRight="55dp"
                        android:gravity="right"
                        android:maxLines="1"
                        android:textColor="@color/black"
                        android:textSize="7dp" />

                    <ImageView
                        android:id="@+id/imageView_valor_anual_icon"
                        android:layout_width="10dp"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal|center_vertical"
                        android:layout_marginBottom="6dp"
                        android:layout_marginLeft="85dp"
                        android:src="@android:drawable/presence_invisible" />

                    <TextView
                        android:id="@+id/textView_aluguel_anual_icon_title"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="right"
                        android:layout_marginTop="18.5dp"
                        android:layout_marginRight="13dp"
                        android:gravity="right"
                        android:text="Anual"
                        android:textColor="@color/black"
                        android:textSize="8dp"
                        android:textStyle="bold" />


                    <TextView
                        android:id="@+id/custom_view_valor_aluguelAnual"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="right"
                        android:layout_marginTop="28dp"
                        android:layout_marginRight="6dp"
                        android:gravity="right"
                        android:maxLines="1"
                        android:textColor="@color/black"
                        android:textSize="7dp" />
                </FrameLayout>


                <FrameLayout
                    android:layout_width="245dp"
                    android:layout_height="60dp"
                    android:layout_gravity="center_vertical|center_horizontal"
                    android:layout_marginTop="4dp"
                    android:background="@color/white">

                    <ImageView
                        android:id="@+id/imageView_venda_shopping"
                        android:layout_width="40dp"
                        android:layout_height="50dp"
                        android:layout_gravity="left"
                        android:layout_marginLeft="20dp"
                        android:layout_marginTop="6dp"
                        android:src="@drawable/venda_shopping" />

                    <TextView
                        android:id="@+id/textView_vendas_icon_title"
                        android:layout_width="wrap_content"
                        android:layout_height="14dp"
                        android:layout_gravity="left"
                        android:layout_marginTop="17dp"
                        android:layout_marginLeft="75dp"
                        android:gravity="left"
                        android:text="Venda"
                        android:textColor="@color/black"
                        android:textSize="@dimen/overlay_venda_icon"
                        android:textStyle="bold" />

                    <TextView
                        android:id="@+id/custom_view_valor_venda"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentBottom="true"
                        android:layout_gravity="left"
                        android:layout_marginTop="30dp"
                        android:layout_marginLeft="70dp"
                        android:gravity="left"
                        android:maxLines="1"
                        android:textColor="@color/green_aliansce"
                        android:textSize="@dimen/overlay_valorVenda"
                        android:textStyle="bold" />

                    <ImageView
                        android:id="@+id/imageView_venda_mensal_icon"
                        android:layout_width="10dp"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal|center_vertical"
                        android:layout_marginBottom="6dp"
                        android:layout_marginLeft="32dp"
                        android:src="@android:drawable/presence_online" />

                    <TextView
                        android:id="@+id/textView_venda_mensal_icon_title"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="right"
                        android:layout_marginTop="18.5dp"
                        android:layout_marginRight="60dp"
                        android:gravity="right"
                        android:text="Mensal"
                        android:textColor="@color/black"
                        android:textSize="8dp"
                        android:textStyle="bold" />

                    <TextView
                        android:id="@+id/custom_view_valor_vendaMensal"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="right"
                        android:layout_marginTop="28dp"
                        android:layout_marginRight="55dp"
                        android:gravity="right"
                        android:maxLines="1"
                        android:textColor="@color/black"
                        android:textSize="8sp" />

                    <ImageView
                        android:id="@+id/imageView_venda_anual_icon"
                        android:layout_width="10dp"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal|center_vertical"
                        android:layout_marginBottom="6dp"
                        android:layout_marginLeft="85dp"
                        android:src="@android:drawable/presence_invisible" />

                    <TextView
                        android:id="@+id/textView_venda_anual_icon_title"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="right"
                        android:layout_marginTop="18.5dp"
                        android:layout_marginRight="13dp"
                        android:gravity="right"
                        android:text="Anual"
                        android:textColor="@color/black"
                        android:textSize="8dp"
                        android:textStyle="bold" />

                    <TextView
                        android:id="@+id/custom_view_valor_vendaAnual"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="right"
                        android:layout_marginTop="28dp"
                        android:layout_marginRight="6dp"
                        android:gravity="right"
                        android:maxLines="1"
                        android:textColor="@color/black"
                        android:textSize="8sp" />

                </FrameLayout>

                <FrameLayout
                    android:layout_width="245dp"
                    android:layout_height="35dp"
                    android:layout_gravity="center_vertical|center_horizontal"
                    android:layout_marginTop="4dp"
                    android:background="@color/white">

                    <ImageView
                        android:id="@+id/imageView_custo_ocupacao_shopping"
                        android:layout_width="40dp"
                        android:layout_height="30dp"
                        android:layout_gravity="left"
                        android:layout_marginTop="3dp"
                        android:layout_marginLeft="20dp"
                        android:src="@drawable/ocupacao_shopping" />

                    <TextView
                        android:id="@+id/textView_custo_ocupacao_icon_title1"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="left"
                        android:layout_marginTop="5dp"
                        android:layout_marginLeft="75dp"
                        android:gravity="left"
                        android:text="Custo"
                        android:textColor="@color/black"
                        android:textSize="@dimen/overlay_venda_icon"
                        android:textStyle="bold" />

                    <TextView
                        android:id="@+id/textView_custo_ocupacao_icon_title2"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="left"
                        android:layout_marginTop="14dp"
                        android:layout_marginLeft="75dp"
                        android:gravity="left"
                        android:text="Ocupação"
                        android:textColor="@color/black"
                        android:textSize="@dimen/overlay_venda_icon"
                        android:textStyle="bold" />

                    <TextView
                        android:id="@+id/badge_custoOcupacao_valor"


            android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentBottom="true"
                    android:layout_gravity="left"
                    android:layout_marginTop="30dp"
                    android:layout_marginLeft="85dp"
                    android:gravity="left"
                    android:maxLines="1"
                    android:textSize="11sp"
                    android:textStyle="bold" />


            </FrameLayout>

        </LinearLayout>
    </LinearLayout>
</LinearLayout>

1
  • Thiago, evite usar formatação de citação perto de código sem ser necessário, pois o código vai precisar de 8 espaços para ficar destacado.
    – user28595
    Commented 28/06/2017 às 14:39

1 Resposta 1

1

Você pode adicionar elevação ao seu FrameLayout. Veja:

<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:elevation="4dp"
    android:translationZ="4dp">

Obs.: O elevation está disponível a partir da v21 Android.

PS.: mais tarde volto aqui e completo essa resposta

2
  • já tentei utilizar este dois comandos no Framelayout e até já tentei aumentar os valores deles, mas não acontece nada. O que será? Commented 28/06/2017 às 14:50
  • 1
    Você precisa colocar um padding no layout externo ao FrameLayout e adicionar neste mesmo layout um android:clipToPadding="false" Commented 28/06/2017 às 16:27

Você deve fazer log-in para responder a esta pergunta.

Esta não é a resposta que você está procurando? Pesquise outras perguntas com a tag .