ListView和图像

Moh*_*lah 1 android listview image android-layout

我有两个ListView +图像的问题.我从包含所有必要信息的xml文件中获取列表的值.

  1. 我需要设置一个Listview.每一行都应包含一个图标和一个标题.该图标是本地drawable(随应用程序发送).

    我想要实现的一个例子可以在这里找到:http://www.tutomobile.fr/wp-content/uploads/2010/07/listViewPerso_1.png

    我需要一种动态方式将图像添加到ListView,xml文件内容可能会更改.

  2. 与上一个相同,但这次图像托管在服务器上,因此我需要从服务器加载它们,然后在列表中显示它们.

Par*_*ani 6

ListView项可以拥有自己的自定义布局.为ListView创建适配器时,可以将布局ID传递给Adapter构造函数.请参见SimpleAdapter和ArrayAdapter.你会have to extend an Adapter and implement getView() to property set the image+text.

这是ListView中完整的示例代码Lazy load of images.你可以重复使用它.