最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Android中html.fromhtml的使用方法
时间:2017-03-06 编辑:简简单单 来源:一聚教程网
Android中html.fromhtml
在android中,有一个容易遗忘的Html.fromhtml方法,意思是可以将比如文本 框中的字符串进行HTML格式化,支持的还是很多的,
但要注意的是要在string.xml中用去转义,比如:
代码如下 | 复制代码 |
Text with markup for [b]bold[/b] and [i]italic[/i] text.
There is also support for a teletype-style font. But no use for the tag!
]]> |
上面就用到了大量的HTML标签了,JAVA代码中这样使用:
代码如下 | 复制代码 |
TextView view = (TextView)findViewById(R.id.sampleText); String formattedText = getString(R.string.htmlFormattedText); Spanned result = Html.fromHtml(formattedText); view.setText(result); |
相关文章
- android Html.fromHtml使用详解 08-04
- sora软件价格介绍 02-22
- sora官网入口地址一览 02-22
- Sora生成的视频使用教程 02-22
- 《梦幻西游》元宵灯谜线索答案大全2024 02-22
- 《原神》有朋自远方来第一天通关攻略 02-22