To work with Custom Font, you need to install the latest version of Android Studio 3.x. Typeface custom_font = Typeface.createFromAsset(getAssets(), 'fonts/font-name.ttf') TextView tv = (TextView)findViewById(R.id.textview1)
The code in the custom view typically looks like: One would also need to have the font file placed in the assets folder. In the custom view, one would create a Typeface and then call setTypeface (or a similar method, that, sets the typeface).
Using Typeface: One would typically need a custom view that extends the equivalent view were trying to apply a font to.Before the release of Android O, fonts can be used in the following 2 ways : So, in this blog, you will understand how to use Custom and Downloadable Fonts in Android? The Older way of using Fontsīefore we move forward to look for the new or the latest way of using the font, let's revise the older way of using fonts. Also, you can choose from any of the thousands of fonts on Google Fonts and use them in your app. Now there is no need of writing some piece of code for using the fonts. One of the really interesting features for developers was the new way to apply fonts right in your XML files. At the Google I/O 2017, Android O or simple Android Oreo was launched and it came with a lot of cool features.