如何改变文字大胆的Andr​​oid? [英] How do you change text to bold in Android?

查看:100
本文介绍了如何改变文字大胆的Andr​​oid?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你如何在Android的TextView更改文本/字体设置?例如,你如何使文本加粗?

How do you change text/font settings in an Android TextView? For example, how do you make the text bold?

推荐答案

要做到这一点,在布局的xml:

To do this in the layout xml:

android:textStyle

例如:

android:textStyle="bold"
android:textStyle="italic"

通过编程的方法是:

Programatically the method is:

setTypeface (Typeface tf)

设定的字体和样式,其中文本的显示方式。请注意,并非所有字样的家庭确实有粗体和斜体变体,所以你可能需要使用setTypeface(字体,int)以得到你真正想要的外观。

Sets the typeface and style in which the text should be displayed. Note that not all Typeface families actually have bold and italic variants, so you may need to use setTypeface(Typeface, int) to get the appearance that you actually want.

这篇关于如何改变文字大胆的Andr​​oid?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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