概述
typeface 字体 , 可用于更改文本中使用的字体的类, Android 默认提供了四种字体分别如下:
- noraml (普通字体,系统默认使用的字体)
- sans(非衬线字体)
- serif (衬线字体)
- monospace(等宽字体)
在xml 中的写法
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Android typeface效果展示"
android:layout_marginTop="10dp"
android:textSize="25sp"
android:typeface="normal" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Android typeface效果展示"
android:layout_marginTop="10dp"
android:textSize="25sp"
android:typeface="sans" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Android typeface效果展示"
android:layout_marginTop="10dp"
android:textSize="25sp"
android:typeface="monospace" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Android typeface效果展示"
android:layout_marginTop="10dp"
android:textSize="25sp"
android:typeface="serif" />
效果图
当然也可以在java 代码中使用setTypeface的方法 设置
同时也可以使用typeface 加载第三方字体,
最后
以上就是光亮豌豆为你收集整理的Andriod TextView typeface的全部内容,希望文章能够帮你解决Andriod TextView typeface所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复