Reputation: 170
I am new to android. I have a textview and want to assign custom font to it. My font file (*.ttf) is on the server. I have to use that file in code to set font dynamically (on the fly). I don't want to put the file in asset folder or any raw folder. How can this be implemented?
Upvotes: 2
Views: 1439
Reputation: 23279
textView.setTypeface(yourTypeface);
Upvotes: 2
Reputation: 90
you need to add your font file to asset folder and then use this in your java code.
Typeface temp = Typeface.createFromAsset(getAssets(), "fonts/RadioLand.ttf");
bat = (TextView)findViewById(R.id.textView1); bat.setTypeface(temp);
Upvotes: 0