Search code examples
androidcolorsandroid-edittextborder

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


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?


Solution

  • 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"