Skip to content

Instantly share code, notes, and snippets.

@zalito12
Created August 15, 2017 18:12
Show Gist options
  • Save zalito12/fa147c24876562bc69b83229daf564fb to your computer and use it in GitHub Desktop.
Save zalito12/fa147c24876562bc69b83229daf564fb to your computer and use it in GitHub Desktop.
Android Custom Font TextView
public class CooperTextView extends AppCompatTextView {
protected CooperTextView(Context context) {
super(context);
if(!isInEditMode())
this.setTypeface(Typeface.createFromAsset(context.getAssets(), "fonts/cooper_std.ttf"));
}
public CooperTextView(Context context, AttributeSet attrs) {
super(context, attrs);
if(!isInEditMode())
this.setTypeface(Typeface.createFromAsset(context.getAssets(), "fonts/cooper_std.ttf"));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment