Android的TextView中使用HTML和放大器;分隔器 [英] Android TextView with HTML & separator

查看:112
本文介绍了Android的TextView中使用HTML和放大器;分隔器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个TextView是一个ListView行项目的一部分。在这个TextView的,我有一些HTML使用Html.fromHtml渲染()。我不知道是否有一种方法做什么是一个有效的< HR> 标记的HTML中,这样它会呈现水平线以内2项之间TextView的。这甚至可能吗?

I have a TextView that is part of a ListView row item. In that TextView, i have some HTML rendered using Html.fromHtml(). I'm wondering if there is a way to do what is effectively an <hr> tag within the html so that it'll render a horizontal line in between 2 items within the TextView. is this even possible?

推荐答案

正如你可以在<一见href="http://www.netmite.com/android/mydroid/frameworks/base/core/java/android/text/Html.java"><$c$c>Html类源$ C ​​$ C ,<一个href="http://developer.android.com/reference/android/text/Html.html#fromHtml%28java.lang.String%29"><$c$c>Html.fromHtml(String)不支持所有HTML标签。这是允许的HTML标签的列表:

As you can see in the Html class source code, Html.fromHtml(String) does not support all HTML tags. This is a list of allowed HTML tags:

  • BR
  • P
  • DIV
  • EM
  • B
  • 强烈
  • 引用
  • DFN
  • 字体
  • 块引用
  • TT
  • 等宽
  • A
  • U
  • SUP
  • br
  • p
  • div
  • em
  • b
  • strong
  • cite
  • dfn
  • i
  • big
  • small
  • font
  • blockquote
  • tt
  • monospace
  • a
  • u
  • sup
  • sub

那么,为什么不直接使用的WebView ,而不是的TextView

So, why don't just use a WebView instead of a TextView?

这篇关于Android的TextView中使用HTML和放大器;分隔器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆