本文介绍了Android的BaseAdapter是适配器模式的示例吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Android的类BaseAdapter在其名称中具有适配器,因为它遵循适配器模式,还是巧合?

解决方案

所以,让我们来解释一下。 BaseAdapters指定要用于需要适配器的程序的接口。其实这个界面叫做Adapter。此接口指定采取任意列表所需的信息,并将其转换为任意长的视图集。 BaseAdapter因此适应您的自定义输入格式(特别是如果您扩展它)到适配器接口。因此,它是适配器设计模式。


Does Android's class BaseAdapter have "Adapter" in its name because it follows the Adapter pattern or is it just a coincidence?

解决方案

From Wikipedia

So, let's discect that. BaseAdapters specify an interface to use for programs that need adapters. In fact, this interface is called Adapter. This interface specifies the information needed to take an arbitrary list, and convert it to an arbitrarily long set of Views. BaseAdapter thus adapts your custom input format (In particularly, if you extend it), to the Adapter interface. Thus, it is an Adapter design pattern.

这篇关于Android的BaseAdapter是适配器模式的示例吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 19:11