Search code examples
androidbuttonshadow

Can the Shadow be made as Blurr in Android?


I am not able to find the exact sloution to make the shadow with the blurr. I am using the simple Concept of displaying the shadow , but only getting the simple shadow without the blurr.How can the shadow be made blurr without using the bitmap images.

main layout

 <*********.CustomFontLoginButton
                            android:id="@+id/btnLogin"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center"
                            android:background="@drawable/buttonbordershadow"
                            android:clickable="true"
                            android:gravity="center"
                            android:padding="15dp"
                            android:text="Login"
                            android:textAllCaps="true"
                            android:textColor="@color/white"
                            android:textSize="14sp" />

buttonbordershadow

<layer-list
    xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/shadow_button"/>
    <item
        android:drawable="@drawable/round_button_login"
        android:bottom="10px" />

</layer-list>

shadow_button

<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="rectangle"
    xmlns:android="http://schemas.android.com/apk/res/android">

    <solid android:color="#59282323"/>
    <corners android:radius="2dp"/>

</shape>

round_button_login

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <gradient
        android:angle="90"
        android:endColor="#8B0318"
        android:startColor="#E31124"></gradient>

    <corners android:radius="2dp" />


</shape>

I am able to get the simple shadow , How can i get the blurr shadow??


Solution

  • have a look on the following code. It might help you.