public class MyText extends TextView {
public MyText(Context context) {
super(context);
init(context);
}
public MyText(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
init(context);
}
public MyText(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context);
}
public MyText(Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
init(context);
}
private void init(Context context) {
Typeface typeface = Typeface.createFromAsset(context.getAssets(),"fonts/fnf.TTF");
this.setTypeface(typeface);
}
}