Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Designing EditText with rounded corners & inner shadow

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?

like image 409
Falling Into Infinity Avatar asked Jul 02 '14 17:07

Falling Into Infinity


1 Answers

Add a corners tag inside your shape tags:

  <corners
      android:radius="5dp" />
like image 166
G.T. Avatar answered Oct 02 '22 13:10

G.T.