修改android按钮的字体颜色

在应用中有自定义button。想修改一下颜色,不知道怎么实现?
我的代码:

public class CustomButton extends Button {
    public CustomButton(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        init();
    }
    public CustomButton(Context context, AttributeSet attrs) {
        super(context, attrs);
        init();
    }
    public CustomButton(Context context) {
        super(context);
        init();
    }
    private void init() {
        if (!isInEditMode()) {
            Typeface tf = Typeface.createFromAsset(getContext().getAssets(), "MyCustomFont.otf");
            setTypeface(tf);
        }
    }
}

setTextColor(Color.BLUE)试试:

private void init() {
        if (!isInEditMode()) {
            Typeface tf = Typeface.createFromAsset(getContext().getAssets(), "MyCustomFont.otf");
            setTypeface(tf);
            setTextColor(Color.BLUE);
        }
    }

在布局文件里android:textColor="#ff0000"就行了

在manifest中:

<application android:theme="@style/ApplicationStyle" android:icon="@drawable/icon" android:label="@string/app_name"> 

在Mystyle.xml中

<style name="ApplicationStyle" parent="android:Theme">
  <item name="android:buttonStyle">@style/CKButton</item>
</style>
 <style name="CKButton" parent="android:style/Widget.Button">
  <item name="android:textSize">19sp</item>
  <item name="android:layout_margin">0dip</item>
  <item name="android:background">#ff0000</item>
 </style>