Created
December 15, 2015 04:59
-
-
Save devrath/65ea63c49a45bd8f0b68 to your computer and use it in GitHub Desktop.
Loading a custom font for a TextView from a custom class
This file contains hidden or 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 CustomTV_Sam_bold extends TextView { | |
| Context context; | |
| public CustomTV_Sam_bold(Context context, AttributeSet attrs, int defStyle) { | |
| super(context, attrs, defStyle); | |
| this.context = context; | |
| init(); | |
| } | |
| public CustomTV_Sam_bold(Context context, AttributeSet attrs) { | |
| super(context, attrs); | |
| init(); | |
| } | |
| public CustomTV_Sam_bold(Context context) { | |
| super(context); | |
| init(); | |
| } | |
| public void init() { | |
| Typeface tf = Typeface.createFromAsset(getContext().getAssets(), "SamsungSharpSans-Bold.ttf"); | |
| setTypeface(tf); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment