Reputation: 22076
I am developing one application in which comic font are used and that can be fetched from assets folder. Now I would like to make the text bold. So I simply use :
Typeface face=Typeface.createFromAsset(this.getAssets(), "fonts/comic.TTF");
la = (TextView) findViewById(R.id.la);
la.setText("Dog");
la.setTextAppearance(getApplicationContext(),R.style.boldText);
la.setTypeface(face);
String.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello World, timerTest!</string>
<string name="app_name">timerTest</string>
<style name="boldText">
<item name="android:textStyle">bold</item>
</style>
</resources>
So the problem is when I run project comic.ttf get properly but bold style does not appear on text
Upvotes: 1
Views: 378
Reputation: 22076
Typeface face=Typeface.createFromAsset(this.getAssets(), "fonts/comic.TTF");
la = (TextView) findViewById(R.id.la);
la.setText("Dog");
la.setTypeface(face,Typeface.BOLD);
Upvotes: 1