简体   繁体   English

JSoup:如何获取html元素并在Textview中设置内容

[英]JSoup : How to get an html element, and set the content in a Textview

Using Jsoup, is it possible to get an html element, and set the content in a Textview and keeping html tag formated ? 使用Jsoup,是否可以获取html元素,并在Textview中设置内容并保持html标签的格式?

Example : 范例:

  1. I get woth JSoup : <span color="red">Hello</span> 我很高兴JSoup: <span color="red">Hello</span>
  2. Set <span color="red">Hello</span> in my textview 在我的文本视图中设置<span color="red">Hello</span>
  3. Output is Hello (in red) in my app 在我的应用中,输出为Hello(红色)
textView.setText(Html.fromHtml("Jsoup Output String Here"));

you can follow this example for jsoup 您可以按照以下示例进行jsoup

http://jsoup.org/cookbook/extracting-data/example-list-links http://jsoup.org/cookbook/extracting-data/example-list-links

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM