Thursday, 30 March 2017

EditText material Design Android





STEP 1 : Create edittext.xml under drawable folder

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <!-- Background Color
    <solid android:color="#ffffff" />-->
    <!-- Border Color -->
    <stroke android:width="1dp" android:color="#5c6f7b" />
    <!-- Round Corners -->
    <corners android:radius="30dp" />
    <padding android:left="16dp"
        android:top="10dp"
        android:right="6dp"
        android:bottom="10dp" />
</shape>

STEP 2 : Set edittext.xml in background of EditText

You can also set drawable icon left or right if you want.

<EditText
   android:id="@+id/etunm"
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:background="@drawable/edittext"
   android:drawableLeft="@drawable/user_icon"
   android:drawablePadding="15dp"
   android:drawableStart="@drawable/user_icon"
   android:hint="@string/uname"
   android:inputType="textEmailAddress"
   android:singleLine="true"
   android:textSize="13sp" />

No comments:

Post a Comment