如何在 Android 中更改字体样式和字体? [英] How to change the Font styles and face in Android?

查看:43
本文介绍了如何在 Android 中更改字体样式和字体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想更改 android 中的字体和样式.这个怎么做?正在使用模拟器.这是否可以在模拟器中更改.是否有任何权限可以做到这一点.提前致谢.

I want to change the font face and styles in android. How to do this? Am using emulator. Is this possible to change in emulator. Is there any permissions available to do that. Thanks in Advance.

推荐答案

在android中只有五种fonttype-face

in android only five fonttype-face

字体

Typeface.DEFAULT
Typeface.MONOSPACE
Typeface.SANS_SERIF
Typeface.DEFAULT_BOLD
Typeface.SERIF

和字体类型

Typeface.NORMAL
Typeface.BOLD
Typeface.BOLD_ITALIC
Typeface.ITALIC

你可以像这样使用

textView.setTypeface(Typeface.DEFAULT, Typeface.BOLD);

和其他方式是您可以下载任何.ttf文件并将其放入资产文件夹并像这样使用

and other way is you can download any .ttf file and put it in asset folder and use like as this

Typeface type=Typeface.createFromAsset(context.getAssets(),
        "DroidSansMono.ttf");
textView.setTypeface(type, null);

这篇关于如何在 Android 中更改字体样式和字体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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