Android ArrayAdapter 、 BaseAdapter 和 ListAdapter 有什么区别

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11628742/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 08:17:10  来源:igfitidea点击:

What is the difference between ArrayAdapter , BaseAdapter and ListAdapter

androidandroid-arrayadapterlistadapterbaseadapter

提问by Kanaiya Katarmal

Could you please tell me difference between ArrayAdapter, BaseAdapterand ListAdapter.

你能告诉我ArrayAdapter,BaseAdapter和之间的区别吗ListAdapter

回答by Ashwin N Bhanushali

BaseAdapteras the name suggests, is a base class for all the adapters.

BaseAdapter顾名思义,是所有适配器的基类。

When you are extending the Base adapter class you need to implement all the methods like getCount(), getId()etc.

当你扩展基本适配器类需要实现所有类的方法getCount()getId()等等。

ArrayAdapteris a class which can work with array of data. You need to override only getview()method.

ArrayAdapter是一个可以处理数据数组的类。您只需要覆盖getview()方法。

ListAdapteris a an interface implemented by concrete adapter classes.

ListAdapter是由具体的适配器类实现的接口。

BaseAdapteris an abstract class whereas ArrayAdapterand ListAdapterare the concrete classes.

BaseAdapter是抽象类,而ArrayAdapterListAdapter是具体类。

ArrayAdapterand ListAdapterclasses are developed since in general we deal with the array data sets and list data sets.

ArrayAdapterListAdapter类的开发是因为通常我们处理数组数据集和列表数据集。

回答by Nirali

ListAdapter

列表适配器

It is an interface that extended Adapter which is the bridge between a ListView and the data that backs the list.

它是一个扩展 Adapter 的接口,它是 ListView 和支持列表的数据之间的桥梁。

BaseAdaper

基础适配器

Common base class of common implementation for an Adapter that can be used in both ListView (by implementing the specialized ListAdapter interface} and Spinner (by implementing the specialized SpinnerAdapter interface.

可在 ListView(通过实现专门的 ListAdapter 接口)和 Spinner(通过实现专门的 SpinnerAdapter 接口)中使用的适配器的通用实现的通用基类。

ArrayAdapter

阵列适配器

A concrete BaseAdapter that is backed by an array of arbitrary objects.

由任意对象数组支持的具体 BaseAdapter。

Refer below links

参考以下链接

  1. ListAdapter

  2. BaseAdapter

  3. ArrayAdapter

  1. 列表适配器

  2. 基本适配器

  3. 阵列适配器