打印html表格,< tr>,< &< a> TextView Android上的标签

发布于 2025-01-31 18:27:51 字数 200 浏览 2 评论 0原文

我有一个通过API接收HTML作为JSON的聊天应用程序。每个聊天消息都在文本视图中显示HTML,但是我需要显示表格和标签。我尝试使用html.fromhtml()函数和图像的imagegetter尝试,但是我找不到显示表标签的方法。

我无法使用WebView,因为这意味着每个消息显示WebView(这不是很高效)。

提前致谢。

I have a chat app that receives HTML as JSON through an API. Each chat message displays the HTML in a TextView, however I need to display Tables, and tags. I have tried with Html.fromHtml() function and an ImageGetter for the images, however I can't find the way to display the Table tags.

I cannot use a WebView because that would imply displaying a webview for every message (which isn't very efficient).

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

原谅我要高飞 2025-02-07 18:27:51

fromhtml()不支持< table和相关标签。您的选择是:

  1. 使用WebView渲染您的HTML表(但正如您所说的那样,您不想这样做)
  2. 通过使用Whitespaces或Padding将表转换为文本。
  3. 在您的Android应用中,本地使用TableLayout

fromHtml() does not support <table> and related tags. Your choices are:

  1. Use WebView to render your HTML table (but as you said you don't want to do that)
  2. Convert your table to text by using whitespaces or padding.
  3. Natively use TableLayout in your Android app.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文