Designing EditText with rounded corners & inner shadow

11,884

Add a corners tag inside your shape tags:

  <corners
      android:radius="5dp" />
Share:
11,884
Falling Into Infinity
Author by

Falling Into Infinity

Updated on June 16, 2022

Comments

  • Falling Into Infinity
    Falling Into Infinity almost 2 years

    I'm trying to create a custom EditText that has both rounded corners and an inner shadow.

    enter image description here

    I made a layer list that creates the inner shadow,

    <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    
        <item >
            <shape android:shape="rectangle">
                <solid android:color="#6C6C6C" />           
            </shape>
        </item>
    
        <item>
            <shape android:shape="rectangle">
                <solid android:color="@color/ashes" />   
            </shape>
        </item>
    
        <!-- White Top color -->
        <item android:top="3px" android:left="3px">
            <shape android:shape="rectangle">
                <solid android:color="#FFFFFF" />           
            </shape>
        </item> 
    </layer-list>
    

    The output looks like this,

    enter image description here

    How can I also add a rounded shape?

  • Shivam Verma
    Shivam Verma almost 10 years
    Also, the previews might not show up in eclipse, so run the application.
  • G.T.
    G.T. almost 10 years
    I think it does not show up in eclipse only if there are different radius for each corner. Anyway it is worth to run the application to be sure ;)