SimpleAdapter用于填充位图和文本视图的ArrayList

时间:2012-02-10 16:10:40

标签: android simpleadapter

我希望能够填充SD卡中存储的位图和arraylist。

现在在android开发人员中,String []来保存一个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中加载位图?”。

2 个答案:

答案 0 :(得分:1)

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

答案 1 :(得分:1)

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

时返回true