问题描述
我想知道,是否有任何指引,我们如何选择之间 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
-
ArrayAdapter
使我们能够在新项目动态添加,该列表在这段时间被显示即使在。需要注意的是,ArrayAdapter
是有方法添加
。 -
SimpleAdapter
用于情况下,一旦该列表被示出,有没有更多的新产品可以增加。
ArrayAdapter
enables us to add in new item dynamically, even after the list is being shown during that time. Note that,ArrayAdapter
is having methodadd
.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之间进行选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!