一、使用系统自带的字体开发Android的人大多都知道,Android里面对字体的支持少得可怜,默认情况下,TextView 的 typeface 属性支持 sans、serif和monospace 这三种字体,如果在没有指定字体的情况下,
一、使用系统自带的字体
开发Android的人大多都知道,Android里面对字体的支持少得可怜,默认情况下,TextView 的 typeface 属性支持 sans、serif和monospace 这三种字体,如果在没有指定字体的情况下,系统会使用 sans 作为文本显示的字体。但这三种字体只支持英文,也就是说只要你显示的文字是中文,无论你选择这三种字体中的哪一种,显示效果都是一样的。
1.在XML文件中设置
<!-- 使用默认的sans字体--><TextView android:id="@+id/sans" android:text="Hello,World" android:textSize="20sp" android:typeface="sans" /><!-- 使用默认的serifs字体--><TextView android:id="@+id/serif" android:text="Hello,World" android:textSize="20sp" android:typeface="serif" /><!-- 使用默认的monospace字体--><TextView android:id="@+id/monospace" android:text="Hello,World" android:textSize="20sp" android:typeface="monospace" />
--结束END--
本文标题: Android为TextView添加字体库和设置描边的方法
本文链接: https://www.lsjlt.com/news/221231.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-05-04
2024-05-04
2024-05-04
2024-05-04
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0