with android studio I have a textview that is the text of my countdown timer. I want to have that text view with digital characters. Can you help me?
Asked
Active
Viewed 3,571 times
3 Answers
5
You have to change the font of the text of text view.
First put the font in your asset folder.
Then in your java file add code like this to change your font:
Typeface myTypeface = Typeface.createFromAsset(this.getAssets(),
"Digital.ttf");
TextView digital= (TextView) findViewById(R.id.your_textView);
digital.setTypeface(myTypeface);
Put Digital.ttf in your asset folder of your project.
This will might help you.

Avijit
- 3,834
- 4
- 33
- 45
-
-
2@user2675569 search in google for `digital font .ttf`..download the .ttf file..and paste it to assets folder – Abhishek V Oct 26 '13 at 14:49
-
-
1@user2675569 In root project folder..Check this.. http://www.androidhive.info/wp-content/uploads/2012/05/android_using_external_fonts.png – Abhishek V Oct 26 '13 at 15:38
-
1Well you can refer this question http://stackoverflow.com/questions/18302603/where-to-place-assets-folder-in-android-studio – Abhishek V Oct 26 '13 at 16:02
-
I put the ttf in the asset folder as digital.ttf and used the code as indicated but at runtime I get a NullPointerException on the setTypeface() line. – Lord of Scripts May 09 '14 at 23:33
-
0
yes you can do this ...
place the ttf file in the assets
folder and do the following code
/**Font Typeface***/
String fontPath = "fonts/DS-Digital.ttf";
/**Font Typeface***/
tf = Typeface.createFromAsset(getAssets(), fontPath);
and then finally set it to textview
TextView wordtext;
wordtext.setTypeface(tf);

Jeffy Lazar
- 1,903
- 13
- 20
0
Download the fonts from below link
http://www.fontpalace.com/font-download/LED.Font/ http://www.fontspace.com/download/13974/c46cca08c1d746a1836e0080c24de5c2/wlm-fonts_lets-go-digital.zip
and crate a Assets folder paste it in ASstest folder of your app Now in Activity
Typeface tf = Typeface.createFromAsset(getAssets(),
"fonts/Digital.otf");
TextView tv = (TextView) findViewById(R.id.Text);
tv.setTypeface(tf)

Kapil Parmar
- 881
- 8
- 19