Created
October 3, 2017 10:13
-
-
Save gajerarajnit/fda711b7062e63e7ac9789722cf7ed0d to your computer and use it in GitHub Desktop.
Apply custom fonts to textview....
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CustomTypeFaceTextViewRegular extends TextView { | |
public TextViewRegular(Context context, AttributeSet attrs, int defStyle) { | |
super(context, attrs, defStyle); | |
applyCustomFont(context); | |
} | |
public TextViewRegular(Context context, AttributeSet attrs) { | |
super(context, attrs); | |
applyCustomFont(context); | |
} | |
public TextViewRegular(Context context) { | |
super(context); | |
applyCustomFont(context); | |
} | |
private void applyCustomFont(Context context) { | |
setTypeface(FontCache.getTypeface("Custom-font-Regular.ttf", context)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment