Android特殊字体的处理---加下划线等
来源:互联网 发布:淘宝一个ip能开几个店 编辑:程序博客网 时间:2024/04/28 09:49
在xml文件中使用android:textStyle="bold" 可以将英文设置成粗体,但是不能将中文设置成粗体,将中文设置成粗体的方法是:
TextView tv = (TextView)findViewById(R.id.TextView01);
TextPaint tp = tv.getPaint();
tp.setFakeBoldText(true);
其他还有:
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 24f);//设置成24sp
textView.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));//可能中文加粗无效
textView.setTypeface(Typeface.defaultFromStyle(Typeface.ITALIC));//可能中文无效
textView.setText(Html.fromHtml(""+texts+""));//下划线
textView.setTypeface(Typeface.MONOSPACE,Typeface.ITALIC);//斜体,中文有效
textView.getPaint().setFlags(Paint. STRIKE_THRU_TEXT_FLAG );//中间加横线
textView.getPaint().setFlags(Paint. UNDERLINE_TEXT_FLAG );//底部加横线
TextView tv = (TextView)findViewById(R.id.TextView01);
TextPaint tp = tv.getPaint();
tp.setFakeBoldText(true);
其他还有:
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 24f);//设置成24sp
textView.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));//可能中文加粗无效
textView.setTypeface(Typeface.defaultFromStyle(Typeface.ITALIC));//可能中文无效
textView.setText(Html.fromHtml(""+texts+""));//下划线
textView.setTypeface(Typeface.MONOSPACE,Typeface.ITALIC);//斜体,中文有效
textView.getPaint().setFlags(Paint. STRIKE_THRU_TEXT_FLAG );//中间加横线
textView.getPaint().setFlags(Paint. UNDERLINE_TEXT_FLAG );//底部加横线
0 0
- Android特殊字体的处理---加下划线等
- Android特殊字体的处理---加下划线等
- Android特殊字体的处理---加下划线…
- Oracle中like查询下划线等特殊字符的处理
- Oracle中like查询下划线等特殊字符的处理
- Oracle中like查询下划线等特殊字符的处理
- Oracle中like查询下划线等特殊字符的处理
- Oracle中like查询下划线等特殊字符的处理
- Oracle中like查询下划线等特殊字符的处理
- Oracle中like查询下划线等特殊字符的处理
- 给字体加下划线
- android TextView加下划线的方法
- android 加下划线
- Android TextView加下划线
- android Textview加下划线
- android Textview加下划线
- android 加下划线
- android Textview加下划线
- [经典面试题][腾讯]选择原料工厂(最短距离问题)
- wince 下APP的背景
- MongoDB 2.6-Windows安装
- SVN版本管理
- android笔记--保存和恢复activity的状态数据
- Android特殊字体的处理---加下划线等
- iOS开发-多线程开发之线程安全篇
- 巴菲特致股东的一封信:1990年
- DBus 入门与应用--基本概念 上(C API 级别的使用观点)
- unity3d中获得物体的size
- 医用电梯节能 备受社会关注
- LeetCode--Rotate Array(2重循环,n-1次swap)
- Android学习整理(一)入门基础--1、eclipse工程结构
- 【BZOJ 3714】 [PA2014]Kuglarz