How to change the border color(un-focused) of an EditText?

Surjya Narayana Padhi picture Surjya Narayana Padhi · Feb 10, 2012 · Viewed 95.7k times · Source

I changed the background color of the EditText to transperant. Now the EditText looks invisible when not focused. So how can I change the un-focused border color of EditText?

What is the XML attribute for this?

Answer

Vikram picture Vikram · Feb 10, 2012

Create a XML file with the following in drawable (say backwithborder.xml):

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <solid android:color="#00000000" />
    <stroke android:width="1dip" android:color="#ffffff" />
</shape>

and for the EditText user attribute android:background="@drawable/backwithborder"