Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

Fonts in Android

Hi How do I add a font file properly in Android Studio?

So far, I have this code:

TextView textView = (TextView)findViewById(R.id.title); Typeface typeFace = Typeface.createFromAsset(getAssets(), "desyrel"); textView.setTypeface(typeFace);

Not sure where to put the font file...I saw some help online that mentioned putting it in an assets folder; I see a folder named that in the intermediaries folder...but do I create the folder somewhere else?

Thanks so much

Michael Cabus

4 Answers

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Michael;

One great resource for Android extensions is the Android Arsenal. If you do a search for Fonts there you will see quite a few free font related libraries, which may make your life easier.

Ken

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Michael;

Welcome to Treehouse!

Take a look here for a general overview of the process, or at this blog post which, while dated, still provides some relevant information.

Ken

Oddly, those resources point to an assets folder..which I don't seem to have by default in my project...I found an assets folder in an "intermediaries" folder..but no luck with that..when I put the fonts folder in the res folder and the program barked at me for it...

Ken Alger
Ken Alger
Treehouse Teacher

Michael;

Hmm, here is a more up to date posting that looks like it is rather thorough.

Sorry about that.

Ken

No, please, treehouse is awesome! So glad for your help...