1

我正在开发一个使用漫画字体并且可以从资产文件夹中获取的应用程序。现在我想让文本加粗。所以我只是使用:

 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); 

字符串.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

4

1 回答 1

1
Typeface face=Typeface.createFromAsset(this.getAssets(), "fonts/comic.TTF"); 

        la = (TextView) findViewById(R.id.la);
        la.setText("Dog");
        la.setTypeface(face,Typeface.BOLD);     
于 2011-08-01T10:25:31.520 回答