6

I Am using "android:Theme.Holo.Light" in my application, it gives blue as the Default color. I want to have a EditText when focused like below.

enter image description here

By default it comes like this when applying holo.light theme. enter image description here

Bhavin Nattar
  • 3,189
  • 2
  • 22
  • 30
Sajeetharan
  • 216,225
  • 63
  • 350
  • 396

2 Answers2

12

You can use Holo Color generator for custom colors.

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

You don't need to download all controls. Only these you want.

Marcin Bigoraj
  • 403
  • 1
  • 4
  • 14
  • it doesn't change default state, only focused and activated – mente Jan 24 '14 at 12:18
  • Hmm... wish it didn't generate the EditTexts with a lip on each end. I don't think the newer version of EditTexts have these. – Alan Aug 17 '16 at 05:12
7

May this help you:

You will have to create/modify your own NinePatch image to replace the default one, and use that as the background of your EditText. If you look in your SDK folder, under your platform, then res/drawable, you should find the NinePatch image for the EditText focus state. If that's all you want to change, you can just pull it into Photoshop, or whatever image editing software you have, and change the orange color to a color of your choosing. Then save that into your drawable folder.

For example:

edittext_modified_states.xml

<?xml version="1.0" encoding="utf-8"?>
<selector 
    xmlns:android="http://schemas.android.com/apk/res/android"
    >
    <item 
        android:state_pressed="true"
        android:drawable="@android:drawable/edittext_pressed" 
        /> <!-- pressed -->    
    <item 
        android:state_focused="true"
        android:drawable="@drawable/edittext_focused_blue" 
        /> <!-- focused -->    
    <item 
        android:drawable="@android:drawable/edittext_normal" 
        /> <!-- default -->
</selector>
Bhavin Nattar
  • 3,189
  • 2
  • 22
  • 30