I am using a custom button class to use a custom font for all the buttons in my app. I would like to change the color too but I don't know how. It is probably pretty easy but I couldn't figure it out.
Here is the code I use:
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);
}
}
}