0

我有文本视图。我无法表现出日本特色。因此将字体下载到 Assets/fonts 文件夹。我试过这段代码

Typeface tf = Typeface.createFromAsset(getAssets(),
            "fonts/ipag.ttf");
    TextView tv=(TextView) findViewById(R.id.name);
    tv.setTypeface(tf);

但应用程序不起作用。应该改变什么?

4

1 回答 1

0

这段代码对我有用:

首先声明字体:

Typeface font;

第二个里面 onCreate:
font = Typeface.createFromAsset(getAssets(), "myfont.ttf");

第三:也在onCreate里面:

myTest = (Button) findViewById(R.id.myTest);
myTest.setTypeface(font);

我的应用程序可以更改其中之一的 languaje 和 japanesse,并且效果很好。这是使用的字体: http ://wowslider.com/styles/miso-bold-webfont.ttf 。
顺便说一句,字体在 Assets 文件夹中。

于 2013-11-10T21:08:49.020 回答