我正在开发一个使用漫画字体的应用程序,可以从 Assets 文件夹中获取它。现在我想把文字加粗。所以我简单地使用:
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>
所以问题是当我正确运行项目 comic.ttf 但 text
上没有出现粗体样式
最佳答案
Typeface face=Typeface.createFromAsset(this.getAssets(), "fonts/comic.TTF");
la = (TextView) findViewById(R.id.la);
la.setText("Dog");
la.setTypeface(face,Typeface.BOLD);
关于android - 文本字体样式不出现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6896826/