如何在android中删除Html标签?

Jee*_*eva 9 html android textview

我正在android中创建一个示例项目.我正在使用示例rss feed.

在这样的xml描述中,

 <![CDATA[
    <p>15&nbsp;Mar&nbsp;2012</p>
     <a href="http://newsonair.nic.in/full_news.asp?TOP2">
     <p style='FONT-SIZE: 12px; LINE-HEIGHT: 150%' align='justify'>
 <img style='FLOAT: left; MARGIN-RIGHT: 5px' height='100' width='100' src=http://www.newsonair.nic.in/writereaddata/news_pictures/PICNEWS1.jpg?
0.7055475></a><br/> 
Parliament was today disrupted over the issue of removal of Trinamool Congress&#39;s leader and the Railway Minister, Mr.Dinesh Trivedi from the Council of Ministers.</p><br clear="all" />
    ]]>
Run Code Online (Sandbox Code Playgroud)

我想要这样显示,

Parliament was today disrupted over the issue of removal of Trinamool Congress&#39;s leader and the Railway Minister, Mr.Dinesh Trivedi from the Council of Ministers.
Run Code Online (Sandbox Code Playgroud)

任何人都可以说出这个想法.谢谢.

waq*_*lam 34

做如下:

String plain = Html.fromHtml("your_html_string").toString();
Run Code Online (Sandbox Code Playgroud)


sdf*_*wer 28

       html = html.replaceAll("<(.*?)\\>"," ");//Removes all items in brackets
       html = html.replaceAll("<(.*?)\\\n"," ");//Must be undeneath
       html = html.replaceFirst("(.*?)\\>", " ");//Removes any connected item to the last bracket
       html = html.replaceAll("&nbsp;"," ");
       html = html.replaceAll("&amp;"," ");
Run Code Online (Sandbox Code Playgroud)

这是我的一段代码.