change the look of Edit Text box in android

Sudhanshu  picture Sudhanshu · Apr 25, 2011 · Viewed 72.2k times · Source

I want to change the way the edit text view looks like... I have found a few answers but they somehow don't solve my purpose... Please kindly provide solutions.

Answer

jheneghan picture jheneghan · Aug 14, 2013

Just to make the comments above a bit clearer:

You should create a file in drawables. e.g: textinputborder.xml..

Then add the following code for the border shape and color to that file:

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#00000000" />    
<stroke android:width="2.5dp" 
    android:color="#FFFFFF" />
<corners
android:radius="5dp"/>
</shape>     

Then use this shape for the edit text widget inside an activity xml file as required:

<EditText
     android:id="@+id/searchBox"        
     android:layout_width="fill_parent"
     android:layout_height="45dp"
     android:background="@drawable/textinputborder"
     android:hint="@string/Search"
     android:paddingLeft="10dp"
     android:inputType="textVisiblePassword" >

 </EditText>