Android – Changing text color of EditText using editTextStyle property

January 21, 2013

In this article, we will create an Android application which will change the text color of EditText widget using ediTextStyle property defined in the file res/values/styles.xml.

This application is developed in Eclipse 4.2.1 with ADT plugin ( 21.0.0 ) and Android SDK ( 21.0.0 ).

1. Create a new Android application project namely “TextColorEditText”

Create a new Android application project namely "TextColorEditText"

Figure 1 : Create a new Android application project namely "TextColorEditText"

2. Configure the project

Configure the project

Figure 2 : Configure the project

3. Design application launcher icon

Design application launcher icon

Figure 3 : Design application launcher icon

4. Create a blank activity to define MainActivity class

Create a blank activity

Figure 4 : Create a blank activity

5. Enter MainActivity details

Enter MainActivity Details

Figure 5 : Enter MainActivity Details

6. Delete Android’s support library from this project, if exists ( Optional Step )

By default Eclipse ( 4.2.1) adds Android Support Library to¬† Android application project. For this application, we don’t need to use this support library. So the library file libs/android-support-v4.jar may be removed manually via ProjectExplorer by simply right click on the file and then clicking the menu item “delete”

7. Update the file res/layout/activity_main.xml

<RelativeLayout xmlns:android=""
    tools:context=".MainActivity" >

        android:text="@string/hello_world" />


8. Update the file res/values/styles.xml

<resources xmlns:android="">
    <color name="red">#ff0000</color>

    <style name="AppBaseTheme" parent="android:Theme.Light">

    <!-- Application theme. -->
    <style name="AppTheme" parent="AppBaseTheme">
        <item name="android:editTextStyle">@style/et</item>

    <style name="et" parent="@android:style/Widget.EditText">
        <item name="android:textColor">@color/red</item>


9. Screenshot of the application in execution

Screenshot of the application in execution

Figure 6 : Screenshot of the application in execution

10. Download source code

How to hire me?

I am George Mathew, working as software architect and Android app developer at

You can hire me on hourly basis or on project basis for Android applications development.

For hiring me, please mail your requirements to

My other blogs

Android Knowledge Quiz

Ready to test your knowledge in Android? Take this quiz :

Tags: , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

Be friend at g+

Subscribe for Lastest Updates

FBFPowered by ®Google Feedburner