views:

38

answers:

1

I want to remove the orange highlight around the EditText. This highlight doesn't match my UI and I really want to get rid of it.

Any ideas?

+1  A: 

EditText uses selector for it's background.

From android source code:

<selector xmlns:android="http://schemas.android.com/apk/res/android"&gt;
    <item android:state_window_focused="false" android:state_enabled="true"
        android:drawable="@drawable/textfield_default" />
    <item android:state_window_focused="false" android:state_enabled="false"
        android:drawable="@drawable/textfield_disabled" />
    <item android:state_pressed="true" android:drawable="@drawable/textfield_pressed" />
    <item android:state_enabled="true" android:state_focused="true" android:drawable="@drawable/textfield_selected" />
    <item android:state_enabled="true" android:drawable="@drawable/textfield_default" />
    <item android:state_focused="true" android:drawable="@drawable/textfield_disabled_selected" />
    <item android:drawable="@drawable/textfield_disabled" />
</selector>

You have to create you own selector where you can use your own drawables for pressed and selected state. You can read more about selectors here

Orsol
Can I in some way use androids default image everywhere instead of using my own drawable?
Julian Assange
You can use "@android:drawable/textfield_default" for ex., but not all images are visible. But you can always copy them from android sources code http://android.git.kernel.org/?p=platform/frameworks/base.git;a=tree;f=core/res/res/drawable-hdpi;h=6e54b40a4b136aaa68016fd6ea1da16d9a9f8724;hb=HEAD.
Orsol
Okay, I see the images now. Just one thing before accept, the image look really compressed?
Julian Assange
What do you mean?
Orsol
If I add the image, isn't it gonna look compressed because of its size?
Julian Assange
No it will look ok. It's Nine-Path images http://developer.android.com/guide/topics/resources/drawable-resource.html#NinePatch .But you have to use density specific images that cantains in drawable-hdpi and drawablw-mdpi
Orsol