public abstract class RecyclingPagerAdapter
extends PagerAdapter
android.support.v4.view.PagerAdapter which behaves like an Adapter with view types and
view recycling.| 构造器和说明 |
|---|
RecyclingPagerAdapter() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
destroyItem(android.view.ViewGroup container,
int position,
java.lang.Object object) |
int |
getItemViewType(int position)
Get the type of View that will be created by
getView(int, android.view.View, android.view.ViewGroup) for the specified item. |
abstract android.view.View |
getView(int position,
android.view.View convertView,
android.view.ViewGroup container)
Get a View that displays the data at the specified position in the data set.
|
int |
getViewTypeCount()
Returns the number of types of Views that will be created by
getView(int, android.view.View, android.view.ViewGroup). |
java.lang.Object |
instantiateItem(android.view.ViewGroup container,
int position) |
boolean |
isViewFromObject(android.view.View view,
java.lang.Object object) |
void |
notifyDataSetChanged() |
public void notifyDataSetChanged()
public final java.lang.Object instantiateItem(android.view.ViewGroup container,
int position)
public final void destroyItem(android.view.ViewGroup container,
int position,
java.lang.Object object)
public final boolean isViewFromObject(android.view.View view,
java.lang.Object object)
public int getViewTypeCount()
Returns the number of types of Views that will be created by
getView(int, android.view.View, android.view.ViewGroup). Each type represents a set of views that can be
converted in getView(int, android.view.View, android.view.ViewGroup). If the adapter always returns the same
type of View for all items, this method should return 1.
This method will only be called when when the adapter is set on the
the AdapterView.
public int getItemViewType(int position)
getView(int, android.view.View, android.view.ViewGroup) for the specified item.position - The position of the item within the adapter's data set whose view type we
want.getView(int, android.view.View, android.view.ViewGroup). Note: Integers must be in the
range 0 to getViewTypeCount() - 1. IGNORE_ITEM_VIEW_TYPE can
also be returned.IGNORE_ITEM_VIEW_TYPEpublic abstract android.view.View getView(int position,
android.view.View convertView,
android.view.ViewGroup container)
LayoutInflater.inflate(int, android.view.ViewGroup, boolean)
to specify a root view and to prevent attachment to the root.position - The position of the item within the adapter's data set of the item whose view
we want.convertView - The old view to reuse, if possible. Note: You should check that this view
is non-null and of an appropriate type before using. If it is not possible to convert
this view to display the correct data, this method can create a new view.
Heterogeneous lists can specify their number of view types, so that this View is
always of the right type (see getViewTypeCount() and
getItemViewType(int)).container - The parent that this view will eventually be attached to