在android中,有一个容易遗忘的Html.fromhtml方法,意思是可以将比如文本
框中的字符串进行HTML格式化,支持的还是很多的,

但要注意的是要在string.xml中用<!--cdata-->去转义,比如:
<string name="htmlFormattedText">      <![CDATA[      Text with markup for [b]bold[/b]      and [i]italic[/i] text.      There is also support for a       <tt>teletype-style</tt> font.       But no use for the <code>code</code>      tag!      ]]></string>

上面就用到了大量的HTML标签了,JAVA代码中这样使用:


TextView view = (TextView)findViewById(R.id.sampleText);String formattedText = getString(R.string.htmlFormattedText);Spanned result = Html.fromHtml(formattedText);view.setText(result);

更多相关文章

  1. intent-filter的data属性详述
  2. Android(安卓)中短信数据库的简单操作
  3. Android(安卓)Html.fromhtml
  4. android的http工具类
  5. 待研究
  6. android中json解析的两个工具:Gson和Jackson的使用小demo
  7. Android获取手机屏幕宽高、状态栏高度以及字符串宽高信息的方法
  8. Android字符串处理类-TextUtils类
  9. Android(安卓)开发必备AS插件,写下来,方便自己用

随机推荐

  1. Android(安卓)studio 引入导入 arr依赖
  2. 详解 Linux 环境下防毒软件 ClamAV
  3. Android(安卓)获取控件高度宽度三种方法,
  4. Android(安卓)Apk自动更新service(直接拿
  5. android web services3
  6. [Android] Viewpager 与 Google map v2
  7. android toast用法总结(一)
  8. Json数据解析
  9. MyAdapter
  10. Nexus刷官方下载的映像_occam