How can I change the focus color (orange) on an EditText box?
The focus color is a small rim around the entire control and is bright
orange when the control has focus. How can I change the color of that
focus to a different color?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You’ll 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, and build a new StateListDrawable, for example something like the below:
edittext_modified_states.xml
I don’t know offhand the actual names for the default NinePatches for the EditText, so replace those as necessary, but the key here is to just use the
@android:drawableimages for the ones you haven’t modified (or you can copy them over to your project’s drawable folder), and then use your modified drawable for your focused state.You can then set this StateListDrawable as the background for your TextView, like so: