Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Roboto font in my android app

Tags:

android

fonts

Hi i am writing an android app. And I want the roboto font in it irrespective of the version of the phone. Is there a way to do it?

Thanks, Rahim.

like image 379
Rahim Avatar asked Jan 19 '12 15:01

Rahim


2 Answers

Yeah why not, you can get the Roboto font :

Android ICS typography

Lets say you want to change the font of a text view :

   Typeface tf = Typeface.createFromAsset(getAssets(),
            "fonts/Roboto-Black.ttf");
    TextView tv = (TextView) findViewById(R.id.FontTextView);
    tv.setTypeface(tf);
like image 133
Reno Avatar answered Sep 30 '22 15:09

Reno


Try this link http://www.barebonescoder.com/2010/05/android-development-using-custom-fonts/

Set the typeface property of the control you are targeting to serif... and for the font file I recommend using TTF, it has worked for me in the past

Also try these links

http://techdroid.kbeanie.com/2011/04/using-custom-fonts-on-android.html

Android - Using Custom Font

like image 20
th30perator Avatar answered Sep 30 '22 16:09

th30perator