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
What is the difference between ArrayAdapter , BaseAdapter and ListAdapter
提问by Kanaiya Katarmal
Could you please tell me difference between ArrayAdapter
, BaseAdapter
and ListAdapter
.
你能告诉我ArrayAdapter
,BaseAdapter
和之间的区别吗ListAdapter
?
回答by Ashwin N Bhanushali
BaseAdapter
as 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()
等等。
ArrayAdapter
is a class which can work with array of data. You need to override only getview()
method.
ArrayAdapter
是一个可以处理数据数组的类。您只需要覆盖getview()
方法。
ListAdapter
is a an interface implemented by concrete adapter classes.
ListAdapter
是由具体的适配器类实现的接口。
BaseAdapter
is an abstract class whereas ArrayAdapter
and ListAdapter
are the concrete classes.
BaseAdapter
是抽象类,而ArrayAdapter
和ListAdapter
是具体类。
ArrayAdapter
and ListAdapter
classes are developed since in general we deal with the array data sets and list data sets.
ArrayAdapter
和ListAdapter
类的开发是因为通常我们处理数组数据集和列表数据集。
回答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
参考以下链接