【问题标题】:ListView and imagesListView 和图像
【发布时间】:2010-09-01 10:15:11
【问题描述】:

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

  1. 我需要设置一个列表视图。每行都应该包含一个图标和一个标题。该图标是本地可绘制的(随应用程序提供)。

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

    我需要一种动态的方式将图像添加到 ListView,xml 文件内容可能会发生变化。

  2. 和之前一样,但是这次图片是托管在服务器上的,所以我需要从服务器加载它们,然后在列表中显示。

【问题讨论】:

    标签: android image listview android-layout


    【解决方案1】:

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

    这是一个完整的示例代码Lazy load of images in ListView。您可以重复使用它。

    【讨论】:

      猜你喜欢
      • 2014-02-01
      • 1970-01-01
      • 1970-01-01
      • 2013-12-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-26
      相关资源
      最近更新 更多