textview设置字体以及引入新字体
来源:互联网 发布:淘宝女装批发网 编辑:程序博客网 时间:2024/05/01 21:37
首先介绍三种默认字体的设置
<!-- 使用默认的sans字体-->
<TextView Android:id="@+id/sans"
Android:text="Hello,World"
Android:typeface="sans"
Android:textSize="20sp" />
<!-- 使用默认的serifs字体-->
<TextView Android:id="@+id/serif"
Android:text="Hello,World"
Android:typeface="serif"
Android:textSize="20sp" />
<!-- 使用默认的monospace字体-->
<TextView Android:id="@+id/monospace"
Android:text="Hello,World"
Android:typeface="monospace"
Android:textSize="20sp" /》
接下来介绍如何引入新字体
建立assets文件在创建fonnts文件夹
然后把**.ttf文件(字体文件)添加进去
最后调用代码
TextView textView =(TextView)findViewById(R.id.text); //将字体文件保存在assets/fonts/目录下,创建Typeface对象 Typeface typeface = Typeface.createFromAsset(getAssets(), "fonnts/fangsong.ttf");//使用字体成仿宋体 textView.setTypeface(typeface);这里有个仿宋字体供大家尝试
0 0
- textview设置字体以及引入新字体
- css 引入新字体
- TextView设置字体样式
- 设置TextView字体
- TextView设置自定义字体
- android TextView 字体设置
- TextVIew字体设置
- Android TextView字体设置
- TextView动态设置字体
- Android textview设置字体
- TextView字体设置
- TextView字体设置不同颜色
- TextView设置字体
- Android设置TextView字体
- android TextView部分字体颜色设置以及图文混排
- TextView设置字体格式以及滚动显示效果
- android-textView-字体的设置
- Android TextView设置字体风格
- LeetCode - 88. Merge Sorted Array - 思路详解 - C++
- Git的诞生
- Rxjava(Rxjava 1.x)
- android 实现view从屏幕中间划出
- 【leetcode】【Easy】【463. Island Perimeter】
- textview设置字体以及引入新字体
- 3632: 外太空旅行
- Cas单点登录客户端配置
- 弹指一挥间
- 重新学习java-第一天(1)
- 重装eclipse后重新配置
- 微信登陆SDK接入 微信 qq 新浪 登陆&&分享
- Python上下文管理器Context Manager
- 119. Pascal's Triangle II