Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/211.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将Android ListView格式化为html?_Android - Fatal编程技术网

如何将Android ListView格式化为html?

如何将Android ListView格式化为html?,android,Android,使用Eclipse制作的Android应用程序中的my ListView: ArrayList<String> planetList = new ArrayList<String>(); planetList.addAll(Arrays.asList(xRemote)); listAdapter = new ArrayAdapter<String>(this, R.layout.simplerow, R.id.rowTextView, pla

使用Eclipse制作的Android应用程序中的my ListView:

ArrayList<String> planetList = new ArrayList<String>();
planetList.addAll(Arrays.asList(xRemote));

listAdapter = new ArrayAdapter<String>(this, R.layout.simplerow,
        R.id.rowTextView, planetList);          

listAdapter.addAll(xRemote);
mainListView.setAdapter(listAdapter);
ArrayList planetList=新建ArrayList();
planetList.addAll(Arrays.asList(xRemote));
listAdapter=new ArrayAdapter(此,R.layout.simplerow,
R.id.rowTextView,planetList);
addAll(xRemote);
mainListView.setAdapter(listAdapter);
获取此输出:

https://www.LinkFromImageonTheGoogle.net/myImage.png
23/03/2014
<a href=http://www.mywebpage.net?ID=764>My remote pics</a>

https://www.LinkFromImageonTheGoogle.net/myImage1.png
22/03/2014
<a href=http://www.mywebpage.net?ID=765>My remote pics 1</a>

https://www.LinkFromImageonTheGoogle.net/myImage2.png
21/03/2014
<a href=http://www.mywebpage.net?ID=766>My remote pics 2</a>
https://www.LinkFromImageonTheGoogle.net/myImage.png
23/03/2014
https://www.LinkFromImageonTheGoogle.net/myImage1.png
22/03/2014
https://www.LinkFromImageonTheGoogle.net/myImage2.png
21/03/2014

如何将此输出格式化为html?

您最好的选择是基于html响应为每个列表项创建一个自定义的
视图(例如,位于文本
旁边的
ImageView
,在此处输入代码,带有链接行为等),但从技术上讲,您可以为每个列表项使用
WebView
,但那将是相当低效的


要提供自定义的
视图
(或
视图组
),您可以提供自己的
适配器
类的实现,并重写适当的方法。例如,您可以创建一个扩展
BaseAdapter
(可能是最灵活的选项)的自定义类,并重写
getView
方法以返回适当的元素集。有许多教程和示例,用于在网络和Android文档中使用
Adapters
自定义
ListView

我不明白您想做什么查看
Html.fromHtml()
我需要ListView上的Html输出…
listAdapter.addAll(Html.fromHtml(xRemote.toString())方法addAll(集合