Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8028201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:04:01+00:00 2026-06-05T00:04:01+00:00

I am trying to design an EditText Field having Shadows (bottom and right side)

  • 0

I am trying to design an EditText Field having Shadows (bottom and right side) like this

enter image description here

tried googling & hunted many SO discussions but all are for TextView not EditText.

This is my code adding shadow to Input Text but not to TextField

<EditText android:id="@+id/txtpin" 
        android:maxLength="4" 
        android:layout_marginLeft="10dp" 
        android:layout_height="37dp" 
        android:gravity="center_horizontal" 
        android:inputType="textPassword" 
        android:longClickable="false" 
        android:layout_width="160dp" 

        android:shadowColor="@color/Black"
        android:shadowDx="1.2"
        android:shadowDy="1.2"
        android:shadowRadius="1.5" 

        android:background="@color/White">
            <requestFocus></requestFocus>
        </EditText>

I guess it needs some custom xml view in drawable but not getting exact idea.
What will be the logic to achieve this.

Any help would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T00:04:03+00:00Added an answer on June 5, 2026 at 12:04 am

    Well.. @Shalini’s answer helped me in this way but still I got another way to achieve 2D shadow with EditText Field and I am going to share with you.

    We need to create custom XML view with three layer for EditText,
    bottom shadow and right side shadow

    Below is my code.

    res/drawable/edittext_shadow.xml

    <?xml version="1.0" encoding="utf-8"?>
    <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    
    <!-- most important is order of layers -->
    
        <!-- Bottom right side 2dp Shadow -->
        <item >
            <shape android:shape="rectangle">
                <solid android:color="#000000" />           
            </shape>
        </item>
    
        <!-- Bottom 2dp Shadow -->
        <item>
            <shape android:shape="rectangle">
                <solid android:color="#000000" />   
            </shape>
        </item>
    
        <!-- White Top color -->
        <item android:bottom="3px" android:right="3px">
            <shape android:shape="rectangle">
                <solid android:color="#FFFFFF" />           
            </shape>
        </item> 
    </layer-list>
    

    Now we can set this shadow view to our TextField using “Background” property

    like this

    res/layout/main.xml

    <EditText android:layout_width="wrap_content" 
                android:id="@+id/txtpin"  
                android:maxLength="4" 
                android:layout_height="37dp" 
                android:gravity="center_horizontal" 
                android:longClickable="false" 
                android:padding="2dp"
    
                android:inputType="textPassword|number" 
                android:password="true" 
                android:background="@drawable/edittext_shadow" 
                android:layout_weight="0.98" 
                android:layout_marginLeft="15dp">
                    <requestFocus></requestFocus>
       </EditText>
    

    and the result screen is like I have posted in question above.

    Thanks to SO, sharing knowledge.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to design a button for an android application like this: The length
I've been trying to design support for recurring events (like you would see in
I am trying to design a 4-bit adder subtracter in verilog. This is only
I'm currently trying to design an application and I'm having trouble trying to decide
I'm trying to design an easily extendable form system in javascript, but am having
I've been trying to design a database schema for a side project but I
I'm trying to design some bookmarklets right now, that connect back to a server
I'm trying to design a gmail like thread messaging system on Google App Engine
I'm trying to design a layout to hold a textview an edit text and
I'm trying to design a code where one guess a number. I defined the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.