How to use SpannableString
来源:互联网 发布:ambari源码 编辑:程序博客网 时间:2024/05/16 08:32
// make the text twice as large
styledString.setSpan(
new
RelativeSizeSpan(2f),
0
,
5
,
0
);
// make text bold
styledString.setSpan(
new
StyleSpan(Typeface.BOLD),
7
,
11
,
0
);
// underline text
styledString.setSpan(
new
UnderlineSpan(),
13
,
23
,
0
);
// make text italic
styledString.setSpan(
new
StyleSpan(Typeface.ITALIC),
25
,
31
,
0
);
styledString.setSpan(
new
StrikethroughSpan(),
33
,
46
,
0
);
// change text color
styledString.setSpan(
new
ForegroundColorSpan(Color.GREEN),
48
,
55
,
0
);
// highlight text
styledString.setSpan(
new
BackgroundColorSpan(Color.CYAN),
57
,
68
,
0
);
// superscript
styledString.setSpan(
new
SuperscriptSpan(),
72
,
83
,
0
);
// make the superscript text smaller
styledString.setSpan(
new
RelativeSizeSpan(
0
.5f),
72
,
83
,
0
);
// subscript
styledString.setSpan(
new
SubscriptSpan(),
87
,
96
,
0
);
// make the subscript text smaller
styledString.setSpan(
new
RelativeSizeSpan(
0
.5f),
87
,
96
,
0
);
// url
styledString.setSpan(
new
URLSpan(
"http://www.google.com"
),
98
,
101
,
0
);
// clickable text
ClickableSpan clickableSpan =
new
ClickableSpan() {
@Override
public
void
onClick(View widget) {
// We display a Toast. You could do anything you want here.
Toast.makeText(SpanExample.
this
,
"Clicked"
, Toast.LENGTH_SHORT).show();
}
};
0 0
- How to use SpannableString
- How To Use DataGird
- how to use typedef
- how to use gz
- How to use chkconfig
- How to use ,,,,
- how to use dialog
- How to use UIDs
- How to use dmalloc
- How to use abld
- How to use BSTR
- How to use Ant
- how to use mstsclib
- how to use gcc
- how to use thread
- how to use ffmpeg
- How to use RDebug
- How to use regex
- rever_string()函数(递归实现)即递归实现字符串反转
- linux下 C语言 访问 mysql 知识整理
- cmux项目总结
- 关于将android项目打成Jar包时遇到的问题
- JAVA的String 类
- How to use SpannableString
- ViewPager中如何获取Fragment
- Linux程序移植到Android上
- Decoding CAPTCHA’s:使用PIL解验证码
- mybatis oracle批量添加
- 汉明距
- 解决SDK更新导致Eclispe中ADT版本太低不能启动
- InstaRecon – Automated Subdomain Discovery Tool
- 黑马程序员——第十章 设计模式