ejo*_*ity -1 user-interface fonts android
我想在Android应用程序中使用新的自定义字体.请在解释时准确而具体,我是新手.也就是说,我想让我的Android应用程序使用这些新的Android自定义字体http://developer.android.com/design/style/typography.html.谢谢.请帮忙.
Aer*_*row 17
我们可以用这种方式使用自定义字体,
TextView txt = (TextView) findViewById(R.id.custom_font);
Typeface font = Typeface.createFromAsset(getAssets(), "Chantelli_Antiqua.ttf");
txt.setTypeface(font);
Run Code Online (Sandbox Code Playgroud)
请参阅本教程以获取完整知识.
您只需将字体.ttf文件放在您的资源文件夹中,并将其分配给文本字段或您要在主活动中应用它的任何内容,如下所示:
TextView txt = (TextView) findViewById(R.id.custom_font);
Typeface font = Typeface.createFromAsset(getAssets(), "Chantelli_Antiqua.ttf");
txt.setTypeface(font);
Run Code Online (Sandbox Code Playgroud)
这是一个很棒的教程,可以教你所有你需要知道的内容:http: //mobile.tutsplus.com/tutorials/android/customize-android-fonts/
| 归档时间: |
|
| 查看次数: |
13149 次 |
| 最近记录: |