Last active
September 14, 2017 13:43
-
-
Save talhahasanzia/5dee0bc5999f761b4807e8d13b2ceac4 to your computer and use it in GitHub Desktop.
Custom Fonts in Android
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
/** | |
* Uses the file name of font usually .ttf format from project and creates a typeface | |
* object that can be used to set text typeface where it is supported. | |
**/ | |
public class TypeFaceHelper | |
{ | |
private Typeface typeFace; | |
public TypeFaceHelper(String fileNameWithExtension) | |
{ | |
typeFace = Typeface.createFromAsset(getAssets(), fileNameWithExtension); | |
} | |
public Typeface getCustomTypeFace() | |
{ | |
return typeFace; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment