ArrayAdapter和SimpleAdapter之间进行选择 [英] Choose between ArrayAdapter and SimpleAdapter

查看:246
本文介绍了ArrayAdapter和SimpleAdapter之间进行选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道,是否有任何指引,我们如何选择之间 ArrayAdapter SimpleAdapter

I was wondering, is there any guideline, on how we choose between ArrayAdapter and SimpleAdapter.

对于每一个列表项,他们将通过几个TextViews和视图psented $ P $,这是很好的被布局。我知道我可以实现既没有任何问题,方法是使用 ArrayAdapter SimpleAdapter

For every list item, they will be presented by several TextViews and Views, which is being layout nicely. I realize I can implement both without any problem, by either using ArrayAdapter or SimpleAdapter.

有没有指引,我们如何选择其中的?我的猜测是

Is there any guideline, on how we choose among them? My guess is

  1. ArrayAdapter 使我们能够在新项目动态添加,该列表在这段时间被显示即使在。需要注意的是, ArrayAdapter 是有方法添加
  2. SimpleAdapter 用于情况下,一旦该列表被示出,有没有更多的新产品可以增加。
  1. ArrayAdapter enables us to add in new item dynamically, even after the list is being shown during that time. Note that, ArrayAdapter is having method add.
  2. SimpleAdapter is used for case, once the list is being shown, there are no more new item can be added.

这是我们应该遵循的准则?

Is this the guideline we should follow?

推荐答案

就个人而言,我不觉得 SimpleAdapter 非常有用的。你的模型数据很少自然地的的ArrayList 地图,这是一种浪费将围绕刚刚复制的东西得到它的适配器。

Personally, I don't find SimpleAdapter terribly useful. Your model data is rarely naturally in "an ArrayList of Maps", and it is wasteful to be copying stuff around just to get it in an adapter.

我要么使用 ArrayAdapter (如果我的模型数据为对象的数组)或者 BaseAdapter (如果我的模型数据是一些其它存储器内数据结构)。

I would either use ArrayAdapter (if my model data is an array of objects) or BaseAdapter (if my model data is some other in-memory data structure).

这篇关于ArrayAdapter和SimpleAdapter之间进行选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆