我是靠谱客的博主 光亮豌豆,这篇文章主要介绍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内容请搜索靠谱客的其他文章。

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

评论列表共有 0 条评论

立即
投稿
返回
顶部