Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a blurred shadow to an edit text?

I want to add a blurred shadow for my edit text but I don't know how? I had made the shape but I don't know the attribute for adding blur to the edit text. I made a drawable resource file and make this as a background to my edit text but it doesn't look as the picture and this my code.

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

    <!-- "shadow" -->
    <item >
        <shape android:shape="rectangle" >
            <solid android:color="#E8E9ED"
                />

            <corners android:radius="20dp" />
        </shape>
    </item>


    <item android:bottom="5px"
        android:left="5px"
        android:right="5px"
        android:top="5px">
        <shape android:shape="rectangle">
            <solid android:color="#FFFFFF"/>
            <corners android:radius="20dp" />
        </shape>
    </item>

</layer-list>

enter image description here

like image 342
BlackAndWhite Avatar asked Jan 01 '26 00:01

BlackAndWhite


1 Answers

The attributes: android:shadowColor, android:shadowRadius, android:shadowDx, and android:shadowDy create text shadow. If want to create a shadow behind your edittext box, you have to create a custom XML view in your res/drawable folder. Then set the attribute android:background="@drawable/customFileName" in your main.xml inside the edittext block. Here is a link to an answer to help you get started: Add drop shadow effects to EditText Field

like image 60
J. Jefferson Avatar answered Jan 03 '26 14:01

J. Jefferson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!