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?
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?
Android OS itself adds border to EditText when user focus on it. The color depends on the OS version. Sometimes we might want to get rid of default focus border and there is a way to do it.
We can keep the background color as transparent to remove the EditText border on focus.
To set the background of edittext to transparent you can use following :
See following links
Android EditText Transparent Background
setting the background attribute to transparent in editext dynamically
Overriding onDraw() for an EditText widget with a blank implementation has no effect
http://www.androidworks.com/changing-the-android-edittext-ui-widget
You can create a linearlayout with background color the color which you want the border should be. Then place the Edit text inside this
Linearlayout
and give some background color. Eg : if border is grey then background forLinearview
is grey. and edit text background black.for width of border you can give
padding = "1dp"
forborder_width = "1dp"
.Create a XML file with the following in drawable (say backwithborder.xml):
and for the EditText user attribute
android:background="@drawable/backwithborder"