10

I would like to know how to change the border color of the EditText view in android to something else...

This is my edittext view:

<EditText
    android:
    android:id="@+id/codeEditText"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_below="@+id/btnEqual"
    android:layout_marginTop="20dp"
    android:ems="10"
    android:gravity="top|left"
    android:inputType="textMultiLine|textNoSuggestions"
    android:scrollbars="vertical"
    android:singleLine="false" >

Thanx upfront.

Eli Revah
  • 3,626
  • 7
  • 27
  • 33

2 Answers2

7

There is a great Widget generator that could do all the job for you, it worked great for me.

You just have to pick your color and which widget you want (EditText for example) then you will get a xml file in the drawable directory, you should set this xml as the background of your Widget and your Done!

http://android-holo-colors.com/

oznus
  • 2,446
  • 2
  • 25
  • 18
0

You have to override the onDraw function to do it. And you will be able to do it in one line. Here is a good example on this presentation at slide 66.

eyal-lezmy
  • 7,090
  • 3
  • 41
  • 35
  • 1
    This will draw a rectangle over the edittext's border. The OP wants to change the color on focus. –  Jul 14 '12 at 17:38