Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 531
Surjya Narayana Padhi Avatar asked Feb 10 '12 08:02

Surjya Narayana Padhi


People also ask

How do you add a border color in XML?

To add a border to Android TextView we need to create an XML containing shape as a rectangle file under the drawable's folder and set it as background to the TextView. <stroke> tag is used to set the border width and color.


1 Answers

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"

like image 66
Vikram Avatar answered Sep 26 '22 04:09

Vikram