XML file saved at res/color/button_text.xml
:android
<?xml version="1.0" encoding="utf-8"?>
<selectorxmlns:android="http://schemas.android.com/apk/res/android">
<itemandroid:state_pressed="true"
android:color="#ffff0000"/><!-- pressed -->
<itemandroid:state_focused="true"
android:color="#ff0000ff"/><!-- focused -->
<itemandroid:color="#ff000000"/><!-- default -->
</selector>
This layout XML will apply the color list to a View:app
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/button_text"
android:textColor="@color/button_text"/>