Android: How to use True Type Fonts (TTF) in your View

1 comment

The stock fonts provided with Android aren't bad, but if you need to give your app/game a bit more mood then you need some custom fonts.

To embed a custom font into your app, you need to create an "assets/fonts" folder and copy your TTF file there.

In your code:

Typeface font = Typeface.createFromAsset(this.getContext().getAssets(), "fonts/Jokerman.ttf");
TextView tv = (TextView) v.findViewById(res);

Can't get much easier than that!


1 comment:

  1. thank you. never knew it wud be this easy


Leave your thoughts ...
If you are having trouble with copy/pasting in comments, you need to sign in or click 'Preview'. For more information about this Firefox bug, see here.

Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog