【问题标题】:SimpleAdapter to populate an ArrayList of bitmaps and textviewsSimpleAdapter 填充位图和文本视图的 ArrayList
【发布时间】:2012-02-10 16:10:40
【问题描述】:

我希望能够填充存储在 SD 卡中的位图和数组列表。

现在在 android 开发人员中,String[]from 保存了 hashmap 加载每个键中使用的项目的键。

SimpleAdapter(Context context, List<? extends Map<String, ?>> data, int resource, String[] from, int[] to)

我的问题更多是如何显示实际的位图图像,因为我知道 "site" 使用示例 HashMap.put(ImageKey, R.id.image) 其中 R.id.image 是整数而不是位图。

我的问题是“如何在 SimpleAdapter 中加载位图?”。

【问题讨论】:

    标签: android simpleadapter


    【解决方案1】:

    快速的答案是你没有。更长的版本是您需要创建自己的 BaseAdapter 子类,您可以在其中使行看起来像您想要的任何东西。从Commonware's books 之一查看this chapter。它将带您完成整个过程。

    【讨论】:

      【解决方案2】:

      您必须使用 api setViewBinder 设置视图绑定器。 您将必须实现 SimpleAdapter.ViewBinder,并且您将获得 setViewValue 函数中每个项目的回调。当您将数据设置为图像时返回 true,并为适配器本身处理绑定返回 false

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-09-30
        • 1970-01-01
        • 2013-06-04
        • 2021-04-29
        • 2023-03-22
        • 2011-04-20
        • 2013-10-14
        • 1970-01-01
        相关资源
        最近更新 更多