I am trying to achieve the effect which is shown in this following image:
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.
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..
Got like this
<?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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With