我是靠谱客的博主 光亮豌豆,最近开发中收集的这篇文章主要介绍Andriod TextView typeface,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

typeface 字体 , 可用于更改文本中使用的字体的类, Android 默认提供了四种字体分别如下:

  1. noraml (普通字体,系统默认使用的字体)
  2. sans(非衬线字体)
  3. serif (衬线字体)
  4. 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所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(64)

评论列表共有 0 条评论

立即
投稿
返回
顶部