GOOGEL对Adapter 如下介绍:
An Adapter object acts as a bridge between an AdapterView
and the underlying data for that view. The Adapter provides access to the data items. The Adapter is also responsible for making aView
for each item in the data set.
AdapterView 如下介绍:
An AdapterView is a view whose children are determined by an Adapter
.
层次结构
所有已知子接口:
ListAdapter,
SpinnerAdapter,
WrapperListAdapter
已知实现类:
AdapterViewl层次结构:
具体例子见谷歌自带例子 API Demos 里面找,例如下面Spinner控件例子:
Spinner s1 = (Spinner) findViewById(R.id.spinner1);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, mStrings);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
s1.setAdapter(adapter);