Rounded Corner Border To Edittext In Android Using XML

EditText can be effortlessly adjusted through activity_main.xml record by means of including another format document and set that rounded_border_edittext.xml document to editText foundation. This kind of editText looks like a large portion of sites applications information accommodation shapes. So here is the entire well ordered instructional exercise for Add adjusted corners outskirt to edittext android utilizing xml.

MainActivity.java

package com.example.edittextwithroundedborder_android_examples.com;
import android.app.Activity;
import android.os.Bundle;


public class MainActivity extends Activity {

 @Override
 protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_main);
 }
}

activity_main.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:tools="http://schemas.android.com/tools"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:paddingBottom="@dimen/activity_vertical_margin"
 android:paddingLeft="@dimen/activity_horizontal_margin"
 android:paddingRight="@dimen/activity_horizontal_margin"
 android:paddingTop="@dimen/activity_vertical_margin"
 tools:context="com.example.edittextwithroundedborder_android_examples.com.MainActivity"
 android:background="#ffffff" >

 <EditText
 android:id="@+id/editText1"
 android:layout_width="wrap_content"
 android:layout_height="55dp"
 android:layout_centerHorizontal="true"
 android:layout_centerVertical="true"
 android:ems="10"
 android:hint="EditTextRoundedBorder"
 android:background="@layout/rounded_border_edittext"
 android:gravity="center" >
 </EditText>

</RelativeLayout>

In Drawable Folder Add One File.

rounded_border_edittext.xml

<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
 <shape android:shape="rectangle">
 <solid android:color="#ffffff"/>
 <corners android:radius="10dp" />
 <stroke
 android:width="2dp"
 android:color="#3bbdfa"
 />
 </shape>
</item>
</selector>