sanju
sanju

Reputation: 113

Android - What is the best way to use a custom font application wide

I want to use Google's Raleway font in my android app. I have read a lot of blogs and a number of answers on stackOverflow but haven't found the exact answer.

The best answer i found is here that explains to create custom TextViews efficiently.

If i have two use two variations of the font say Raleway-Regular and Raleway-SemiBold, do i have to create two custom TextViews or is there any better way to achieve that ?

Upvotes: 0

Views: 1444

Answers (3)

Rakshit Nawani
Rakshit Nawani

Reputation: 2604

I have done the task the following way Download the ttf of that font and then paste it inside the asset folder(you have to create the assets folder inside /src/main/assets) then change the font the following way:

Typeface face = Typeface.createFromAsset(getAssets(), "condenced.ttf"); tv_the.setTypeface(face);

you can download the multiple ttf files and can display the different fonts to different fields. Hope this helps.

Upvotes: 1

kazhiu
kazhiu

Reputation: 789

For me the best way to use a custom font is this library: Calligraphy

Upvotes: 0

Amit Tiwari
Amit Tiwari

Reputation: 3692

I am using Calligraphy library for my project and it works perfect.

Upvotes: 0

Related Questions