public abstract class ArrayAdapterCompat<T>
extends android.widget.BaseAdapter
implements android.widget.Filterable
| 限定符和类型 | 字段和说明 |
|---|---|
protected android.widget.Filter |
mFilter |
protected java.lang.Object |
mLock
Lock used to modify the content of
mObjects. |
protected java.util.List<T> |
mObjects
Contains the list of objects that represent the data of this ArrayAdapter.
|
protected java.util.List<T> |
mOriginalValues |
| 构造器和说明 |
|---|
ArrayAdapterCompat(android.content.Context context)
Constructor
|
ArrayAdapterCompat(android.content.Context context,
java.util.List<T> objects)
Constructor
|
ArrayAdapterCompat(android.content.Context context,
T[] objects)
Constructor
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
add(int index,
T object)
Adds the specified object at the index
|
void |
add(T object)
Adds the specified object at the end of the array.
|
void |
addAll(java.util.Collection<? extends T> collection)
Adds the specified Collection at the end of the array.
|
void |
addAll(int index,
java.util.Collection<? extends T> collection)
Inserts the specified objects at the specified index in the array.
|
void |
addAll(int index,
T... items)
Inserts the specified objects at the specified index in the array.
|
void |
addAll(T... items)
Adds the specified items at the end of the array.
|
void |
clear()
Remove all elements from the list.
|
boolean |
contains(T object)
check contains the object.
|
java.util.List<T> |
getAllItems() |
android.content.Context |
getContext()
Returns the context associated with this array adapter.
|
int |
getCount() |
android.widget.Filter |
getFilter() |
T |
getItem(int position) |
long |
getItemId(int position) |
int |
getPosition(T item)
Returns the position of the specified item in the array.
|
int |
indexOf(T object)
check contains the object.
|
void |
insert(T object,
int index)
Inserts the specified object at the specified index in the array.
|
void |
notifyDataSetChanged() |
void |
remove(T object)
Removes the specified object from the array.
|
boolean |
removeAll(java.util.Collection<?> collection)
Removes the specified objects.
|
void |
removeAt(int index)
Removes the specified object in index from the array.
|
void |
set(int index,
T object)
set the specified object at index
|
void |
setAll(java.util.Collection<? extends T> collection) |
void |
setAll(T... items) |
void |
setFilter(android.widget.Filter filter) |
void |
setNotifyOnChange(boolean notifyOnChange)
Control whether methods that change the list (
add(T),
insert(T, int), remove(T), clear()) automatically call
notifyDataSetChanged(). |
void |
sort(java.util.Comparator<? super T> comparator)
Sorts the content of this adapter using the specified comparator.
|
areAllItemsEnabled, getAutofillOptions, getDropDownView, getItemViewType, getViewTypeCount, hasStableIds, isEmpty, isEnabled, notifyDataSetInvalidated, registerDataSetObserver, setAutofillOptions, unregisterDataSetObserverprotected final java.lang.Object mLock
mObjects. Any write operation
performed on the array should be synchronized on this lock. This lock is also
used by the filter (see getFilter() to make a synchronized copy of
the original array of data.protected java.util.List<T> mObjects
protected java.util.List<T> mOriginalValues
protected android.widget.Filter mFilter
public ArrayAdapterCompat(android.content.Context context)
context - The current context.public ArrayAdapterCompat(android.content.Context context,
T[] objects)
context - The current context.objects - The objects to represent in the ListView.public ArrayAdapterCompat(android.content.Context context,
java.util.List<T> objects)
context - The current context.objects - The objects to represent in the ListView.public void add(T object)
object - The object to add at the end of the array.public void add(int index,
T object)
object - The object to add at the end of the array.public void set(int index,
T object)
object - The object to add at the end of the array.public void setAll(java.util.Collection<? extends T> collection)
public void setAll(T... items)
public void addAll(java.util.Collection<? extends T> collection)
collection - The Collection to add at the end of the array.public void addAll(T... items)
items - The items to add at the end of the array.public void addAll(int index,
java.util.Collection<? extends T> collection)
collection - The objects to insert into the array.index - The index at which the object must be inserted.public void addAll(int index,
T... items)
items - The objects to insert into the array.index - The index at which the object must be inserted.public java.util.List<T> getAllItems()
public void insert(T object, int index)
object - The object to insert into the array.index - The index at which the object must be inserted.public boolean contains(T object)
object - The object to remove.public int indexOf(T object)
object - The object to remove.public void remove(T object)
object - The object to remove.public void removeAt(int index)
index - The index to remove.public boolean removeAll(java.util.Collection<?> collection)
collection - The collection to remove.public void clear()
public void sort(java.util.Comparator<? super T> comparator)
comparator - The comparator used to sort the objects contained
in this adapter.public void notifyDataSetChanged()
notifyDataSetChanged 在类中 android.widget.BaseAdapterpublic void setNotifyOnChange(boolean notifyOnChange)
add(T),
insert(T, int), remove(T), clear()) automatically call
notifyDataSetChanged(). If set to false, caller must
manually call notifyDataSetChanged() to have the changes
reflected in the attached view.
The default is true, and calling notifyDataSetChanged()
resets the flag to true.notifyOnChange - if true, modifications to the list will
automatically call notifyDataSetChanged()public android.content.Context getContext()
public int getCount()
getCount 在接口中 android.widget.Adapterpublic T getItem(int position)
getItem 在接口中 android.widget.Adapterpublic int getPosition(T item)
item - The item to retrieve the position of.public long getItemId(int position)
getItemId 在接口中 android.widget.Adapterpublic android.widget.Filter getFilter()
getFilter 在接口中 android.widget.Filterablepublic void setFilter(android.widget.Filter filter)