A non technical user of your application doesn’t understand technicality of application but one thing he or she can visualise is application’s User interface (UI). An enticing and remarkable user interface is right blend of relevant colours , relevant images , relevant backgrounds and relevant fonts etc and some how linking themselves to application theme.
After Understanding this need of application users, android empowered developers to customize UI . In this tutorial we are going to use custom fonts that can be provided by Google web fonts. But the instructions are equally applied to other proprietary fonts. Right font with Right theme enhance the beauty of whole User Interface in turn increases user engagement.
Fonts are implemented using .ttf files.
Visit http://fonts.google.com to download custom fonts (.ttf files) by Google also called Google Web Fonts. So you will be greeted with below screen
In above screen / web page you can search for more fonts at top right search box. Doing this will show resultant fonts. Then you need to choose a font by pressing ‘plus’ icon. So you will see below screen
here you can font belong to which font family. Now if you see the dialog screen ,at the top right there is a download icon. Download respective font file by pressing that icon. So you will see .ttf file is dowloaded.
Now in android copy <fontfile>.ttf file in assets folder. Create assests folder inside app/src/main folder if it is not present.
In your java file , Suppose you have textview tv to which you want to apply custom font. You can simply do
AssetManager am = getActivity().getAssets();
Typeface typeface = Typeface.createFromAsset(am,"font_file.ttf");
And you can see your textview is having a nice font when app is running on device.