Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Edit text with round corner and shadow

I am trying to achieve the effect which is shown in this following image:

enter image description here

In this image there is an edittext with round corner and internal shadow at top. I tried a lot but not success in getting shadow inside edittext.

I searched on this topic but all examples show shadow outside edittext border. I have no idea how can I achieve this.

The button and background image is already done, The only thing which is left is edittext shadow. If someone has already done this or know how to do this please share with me. Any help whould be appreciated.

like image 368
Pari Avatar asked Jan 02 '13 13:01

Pari


2 Answers

Just create an xml file in your drawable folder name as round_corner.xml.And add this following code.

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

    <corners
        android:radius="3dp"
       />
    <solid
        android:color="@android:color/white"/>

</shape>

At Last you add this xml in background property of your Edittext as follows:-

 <EditText
    android:id="@+id/ed1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/round_corner"
  />

Done..Definitely it works..

like image 25
Born To Win Avatar answered Oct 21 '22 16:10

Born To Win


Got like this

enter image description here

<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android">
        <gradient
            android:centerY="0.2"
            android:startColor="#FFBDBDBD"
            android:centerColor="#65FFFFFF"
            android:endColor="#00FFFFFF"
            android:angle="270"
            />
        <stroke
            android:width="1dp"
            android:color="#C3C3C3" />
        <corners
            android:radius="25dp" />
</shape>
like image 141
Abdul Saleem Avatar answered Oct 21 '22 17:10

Abdul Saleem