Android的 - 如何设置自定义字体的整个应用程序 [英] Android - How to set a custom font for whole app

查看:144
本文介绍了Android的 - 如何设置自定义字体的整个应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
  <一href="http://stackoverflow.com/questions/2711858/is-it-possible-to-set-font-for-entire-application">Is可以设置字体为整个应用程序?

我需要设置一个自定义的字体(.TTF格式),整个应用程序,我该怎么办呢? 从清单或XML将是最好的选择,如果有可能

I need to set a custom font (.ttf format) for whole app, how can i do it? From Manifest or XML would be the best option if it is possible

推荐答案

修改2014年9月:

有关人仍然看到这个老可怕的答案,真正的,好的答案就在这里:

For anyone still seeing this old terrible answer, the real, good answer is here:

<一个href="http://stackoverflow.com/a/16883281/1154026">http://stackoverflow.com/a/16883281/1154026

OLD:

您最好的选择是这样的:

Your best bet would be this:

定制的Andr​​oid字体

于是

    TextView text = (TextView) findViewById(R.id.custom_font);
    Typeface font = Typeface.createFromAsset(getAssets(), "yourfont.ttf");
    text.setTypeface(font);

通过在资产文件夹的根目录中的.TTF。

With your .ttf in the root of the "assets" folder.

这篇关于Android的 - 如何设置自定义字体的整个应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆