2012-04-12 81 views
0

设置为HTML标签,以普通视图我有这样的HTML博客我怎样才能在Android的

<head> 
<style> 
<!--.hmmessage P 
{ 
margin:0px; 
padding:0px 
} 
body.hmmessage 
{ 
font-size: 10pt; 
font-family:Tahoma 
} 
--></style></head> 
<body class='hmmessage'><div dir='ltr'> 
text<div>write</div> 
</div></body> 
</html> 

文本和写是结果。 这个HTML标签必须显示为

----------- 
text write | 
----------- 

我怎样才能做到这在Android中任何帮助,将不胜感激。

回答

0

在我看来,这应该是很容易从CSS实现:

div.ltr div 
{ 
display:inline; 
} 
+0

我不明白。我是否搜索此代码“css到正常视图”? – Merve 2012-04-12 12:16:20

0

使用TextView在应用程式中呈现的文本。

+0

我必须使用ListView来显示它们,就像本例中的“文字写入”一样。但他们正在使用这些标签 – Merve 2012-04-12 12:18:53

+0

您实际上使用TextViews将文本显示为ListView内的列表项目。所以,无论如何你最后的手段仍然是TextViews – waqaslam 2012-04-12 12:23:57

+0

我理解,但我需要做的不要显示这些代码“< - hmmessage P { 保证金:0像素; 填充:0像素 }! body.hmmessage { 字体-size:10PT; 字体-family:宋体 } - 在TextView的 – Merve 2012-04-12 13:20:35

0

使用HTML在textviewbutton如下

String htmltext = "<html><body>/*... html body here...*/</body></html>"; 

textview.setText(Html.fromHtml(htmltext)); 

,如果你想使用CSS样式或JavaScript使用webview

webview.loadDataWithBaseURL(null, htmltext, "text/html", "UTF-8", null);

+0

利用该代码示例中,应用程序显示<>” - hmmessage P { 余量:!0像素; padding:0px } body.hmmessage { font-size:10pt; font-family:Tahoma } - > text write – Merve 2012-04-12 12:58:35

+0

但我只想写“文字写”我该怎么办? – Merve 2012-04-12 12:59:36

+0

TextView支持的HTML标签在[此链接](http://commonsware.com/blog/Android/2010/05/26/html-tags-supported-by-textview.html)中给出。样式标签不被支持。 – Ravi1187342 2012-04-12 13:17:32