1

コミック フォントを使用し、assets フォルダーから取得できるアプリケーションを 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 に答える