Android7.0中文文档(API)-- ArrayAdapter

来源:互联网 发布:初中数学辅导软件 编辑:程序博客网 时间:2024/06/01 08:25

完整内容,请查看:http://www.zhdoc.net/android/reference/android/widget/ArrayAdapter.html
ArrayAdapter

public class ArrayAdapter
extends BaseAdapter implements Filterable, ThemedSpinnerAdapter

java.lang.Object   ↳android.widget.BaseAdapter    ↳android.widget.ArrayAdapter<T>

A concrete BaseAdapter that is backed by an array of arbitrary objects. By default this class expects that the provided resource id references a single TextView. If you want to use a more complex layout, use the constructors that also takes a field id. That field id should reference a TextView in the larger layout resource.
一个由任意对象数组支持的具体的BaseAdapter。默认情况下,这个类希望通过所提供的资源id来引用一个TextView。如果你想要使用更复杂的布局,请使用包含id字段的构造函数。该id字段应该在较大的布局资源中引用TextView。

However the TextView is referenced, it will be filled with the toString() of each object in the array. You can add lists or arrays of custom objects. Override the toString() method of your objects to determine what text will be displayed for the item in the list.
但是,引用的TextView将由数组中的每个对象的toString()方法来填充。你可以添加列表或自定义对象的数组。重载你的对象的toString()方法,以决定为列表中的项显示什么文本。

To use something other than TextViews for the array display, for instance, ImageViews, or to have some of data besides toString() results fill the views, overridegetView(int, View, ViewGroup) to return the type of view you want.
要在除了TextView之外的其他控件中显示数组,例如,ImageView,或者除toString()之外的一些数据来填充视图,重载getView(int, View, ViewGroup),以返回你想要的视图类型。

摘要


继承常量

From interface android.widget.Adapter

Public构造方法

ArrayAdapter(Context context, int resource)

Constructor
构造方法

ArrayAdapter(Context context, int resource, int textViewResourceId)

Constructor
构造方法

ArrayAdapter(Context context, int resource, T[] objects)

Constructor
构造方法

ArrayAdapter(Context context, int resource, int textViewResourceId, T[] objects)

Constructor
构造方法

ArrayAdapter(Context context, int resource, List<T> objects)

Constructor
构造方法

ArrayAdapter(Context context, int resource, int textViewResourceId, List<T> objects)

Constructor
构造方法

阅读全文
0 0
原创粉丝点击