|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectandroid.view.View
android.view.ViewGroup
android.widget.AdapterView<T>
public abstract class AdapterView<T extends Adapter>
An AdapterView is a view whose children are determined by an Adapter.
See ListView, GridView, Spinner and
Gallery for commonly used subclasses of AdapterView.
| Nested Class Summary | |
|---|---|
static class |
AdapterView.AdapterContextMenuInfo
Extra menu information provided to the android.view.View.OnCreateContextMenuListener#onCreateContextMenu(ContextMenu, View, ContextMenuInfo)
callback when a context menu is brought up for this AdapterView. |
(package private) class |
AdapterView.AdapterDataSetObserver
|
static interface |
AdapterView.OnItemClickListener
Interface definition for a callback to be invoked when an item in this AdapterView has been clicked. |
static interface |
AdapterView.OnItemLongClickListener
Interface definition for a callback to be invoked when an item in this view has been clicked and held. |
static interface |
AdapterView.OnItemSelectedListener
Interface definition for a callback to be invoked when an item in this view has been selected. |
| Nested classes/interfaces inherited from class android.view.ViewGroup |
|---|
ViewGroup.LayoutParams, ViewGroup.MarginLayoutParams, ViewGroup.OnHierarchyChangeListener |
| Nested classes/interfaces inherited from class android.view.View |
|---|
View.BaseSavedState, View.MeasureSpec, View.OnClickListener, View.OnCreateContextMenuListener, View.OnFocusChangeListener, View.OnKeyListener, View.OnLongClickListener, View.OnTouchListener |
| Field Summary | |
|---|---|
static int |
INVALID_POSITION
Represents an invalid position. |
static long |
INVALID_ROW_ID
Represents an empty or invalid row id |
static int |
ITEM_VIEW_TYPE_HEADER_OR_FOOTER
The item view type returned by Adapter.getItemViewType(int) when
the item is a header or footer. |
static int |
ITEM_VIEW_TYPE_IGNORE
The item view type returned by Adapter.getItemViewType(int) when
the adapter does not want the item's view recycled. |
(package private) boolean |
mBlockLayoutRequests
When set to true, calls to requestLayout() will not propagate up the parent hierarchy. |
(package private) boolean |
mDataChanged
True if the data has changed since the last layout |
(package private) View |
mEmptyView
View to show if there are no items to show. |
(package private) int |
mFirstPosition
The position of the first child displayed |
(package private) boolean |
mInLayout
Indicates that this view is currently being laid out. |
(package private) int |
mItemCount
The number of items in the current adapter. |
(package private) boolean |
mNeedSync
True if we need to sync to mSyncRowId |
(package private) int |
mNextSelectedPosition
The position within the adapter's data set of the item to select during the next layout. |
(package private) long |
mNextSelectedRowId
The item id of the item to select during the next layout. |
(package private) int |
mOldItemCount
The number of items in the adapter before a data changed event occured. |
(package private) int |
mOldSelectedPosition
The last selected position we used when notifying |
(package private) long |
mOldSelectedRowId
The id of the last selected position we used when notifying |
(package private) AdapterView.OnItemClickListener |
mOnItemClickListener
The listener that receives notifications when an item is clicked. |
(package private) AdapterView.OnItemLongClickListener |
mOnItemLongClickListener
The listener that receives notifications when an item is long clicked. |
(package private) AdapterView.OnItemSelectedListener |
mOnItemSelectedListener
The listener that receives notifications when an item is selected. |
(package private) int |
mSelectedPosition
The position within the adapter's data set of the currently selected item. |
(package private) long |
mSelectedRowId
The item id of the currently selected item. |
(package private) int |
mSpecificTop
The offset in pixels from the top of the AdapterView to the top of the view to select during the next layout. |
(package private) long |
mSyncHeight
Height of the view when mSyncPosition and mSyncRowId where set |
(package private) int |
mSyncMode
Indicates whether to sync based on the selection or position. |
(package private) int |
mSyncPosition
Position from which to start looking for mSyncRowId |
(package private) long |
mSyncRowId
Row id to look for when data has changed |
(package private) static int |
SYNC_FIRST_POSITION
Sync based on the first child displayed |
(package private) static int |
SYNC_MAX_DURATION_MILLIS
Maximum amount of time to spend in findSyncPosition() |
(package private) static int |
SYNC_SELECTED_POSITION
Sync based on the selected child |
| Constructor Summary | |
|---|---|
AdapterView(Context context)
|
|
AdapterView(Context context,
AttributeSet attrs)
|
|
AdapterView(Context context,
AttributeSet attrs,
int defStyle)
|
|
| Method Summary | |
|---|---|
void |
addView(View child)
This method is not supported and throws an UnsupportedOperationException when called. |
void |
addView(View child,
int index)
This method is not supported and throws an UnsupportedOperationException when called. |
void |
addView(View child,
int index,
ViewGroup.LayoutParams params)
This method is not supported and throws an UnsupportedOperationException when called. |
void |
addView(View child,
ViewGroup.LayoutParams params)
This method is not supported and throws an UnsupportedOperationException when called. |
protected boolean |
canAnimate()
Indicates whether the view group has the ability to animate its children after the first layout. |
(package private) void |
checkFocus()
|
(package private) void |
checkSelectionChanged()
|
protected void |
dispatchRestoreInstanceState(SparseArray<Parcelable> container)
Override to prevent thawing of any views created by the adapter. |
protected void |
dispatchSaveInstanceState(SparseArray<Parcelable> container)
Override to prevent freezing of any views created by the adapter. |
(package private) int |
findSyncPosition()
Searches the adapter for a position matching mSyncRowId. |
abstract T |
getAdapter()
Returns the adapter currently associated with this widget. |
int |
getCount()
|
View |
getEmptyView()
When the current adapter is empty, the AdapterView can display a special view call the empty view. |
int |
getFirstVisiblePosition()
Returns the position within the adapter's data set for the first item displayed on screen. |
Object |
getItemAtPosition(int position)
Gets the data associated with the specified position in the list. |
long |
getItemIdAtPosition(int position)
|
int |
getLastVisiblePosition()
Returns the position within the adapter's data set for the last item displayed on screen. |
AdapterView.OnItemClickListener |
getOnItemClickListener()
|
AdapterView.OnItemLongClickListener |
getOnItemLongClickListener()
|
AdapterView.OnItemSelectedListener |
getOnItemSelectedListener()
|
int |
getPositionForView(View view)
Get the position within the adapter's data set for the view, where view is a an adapter item or a descendant of an adapter item. |
Object |
getSelectedItem()
|
long |
getSelectedItemId()
|
int |
getSelectedItemPosition()
Return the position of the currently selected item within the adapter's data set |
abstract View |
getSelectedView()
|
(package private) void |
handleDataChanged()
|
(package private) boolean |
isInFilterMode()
Indicates whether this view is in filter mode. |
(package private) int |
lookForSelectablePosition(int position,
boolean lookDown)
Find a position that can be selected (i.e., is not a separator). |
protected void |
onLayout(boolean changed,
int left,
int top,
int right,
int bottom)
Called from layout when this view should assign a size and position to each of its children. |
boolean |
performItemClick(View view,
int position,
long id)
Call the OnItemClickListener, if it is defined. |
(package private) void |
rememberSyncState()
Remember enough information to restore the screen state when the data has changed. |
void |
removeAllViews()
This method is not supported and throws an UnsupportedOperationException when called. |
void |
removeView(View child)
This method is not supported and throws an UnsupportedOperationException when called. |
void |
removeViewAt(int index)
This method is not supported and throws an UnsupportedOperationException when called. |
(package private) void |
selectionChanged()
|
abstract void |
setAdapter(T adapter)
Sets the adapter that provides the data and the views to represent the data in this widget. |
void |
setEmptyView(View emptyView)
Sets the view to show if the adapter is empty |
void |
setFocusable(boolean focusable)
Set whether this view can receive the focus. |
void |
setFocusableInTouchMode(boolean focusable)
Set whether this view can receive focus while in touch mode. |
(package private) void |
setNextSelectedPositionInt(int position)
Utility to keep mNextSelectedPosition and mNextSelectedRowId in sync |
void |
setOnClickListener(View.OnClickListener l)
Register a callback to be invoked when this view is clicked. |
void |
setOnItemClickListener(AdapterView.OnItemClickListener listener)
Register a callback to be invoked when an item in this AdapterView has been clicked. |
void |
setOnItemLongClickListener(AdapterView.OnItemLongClickListener listener)
Register a callback to be invoked when an item in this AdapterView has been clicked and held |
void |
setOnItemSelectedListener(AdapterView.OnItemSelectedListener listener)
Register a callback to be invoked when an item in this AdapterView has been selected. |
(package private) void |
setSelectedPositionInt(int position)
Utility to keep mSelectedPosition and mSelectedRowId in sync |
abstract void |
setSelection(int position)
Sets the currently selected item |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface android.view.ViewParent |
|---|
createContextMenu, getParent, isLayoutRequested, requestLayout |
| Field Detail |
|---|
public static final int ITEM_VIEW_TYPE_IGNORE
Adapter.getItemViewType(int) when
the adapter does not want the item's view recycled.
public static final int ITEM_VIEW_TYPE_HEADER_OR_FOOTER
Adapter.getItemViewType(int) when
the item is a header or footer.
int mFirstPosition
int mSpecificTop
int mSyncPosition
long mSyncRowId
long mSyncHeight
boolean mNeedSync
int mSyncMode
SYNC_SELECTED_POSITION or
SYNC_FIRST_POSITION.
static final int SYNC_SELECTED_POSITION
static final int SYNC_FIRST_POSITION
static final int SYNC_MAX_DURATION_MILLIS
findSyncPosition()
boolean mInLayout
AdapterView.OnItemSelectedListener mOnItemSelectedListener
AdapterView.OnItemClickListener mOnItemClickListener
AdapterView.OnItemLongClickListener mOnItemLongClickListener
boolean mDataChanged
int mNextSelectedPosition
long mNextSelectedRowId
int mSelectedPosition
long mSelectedRowId
View mEmptyView
int mItemCount
int mOldItemCount
public static final int INVALID_POSITION
public static final long INVALID_ROW_ID
int mOldSelectedPosition
long mOldSelectedRowId
boolean mBlockLayoutRequests
| Constructor Detail |
|---|
public AdapterView(Context context)
public AdapterView(Context context,
AttributeSet attrs)
public AdapterView(Context context,
AttributeSet attrs,
int defStyle)
| Method Detail |
|---|
public void setOnItemClickListener(AdapterView.OnItemClickListener listener)
listener - The callback that will be invoked.public final AdapterView.OnItemClickListener getOnItemClickListener()
public boolean performItemClick(View view,
int position,
long id)
view - The view within the AdapterView that was clicked.position - The position of the view in the adapter.id - The row id of the item that was clicked.
public void setOnItemLongClickListener(AdapterView.OnItemLongClickListener listener)
listener - The callback that will runpublic final AdapterView.OnItemLongClickListener getOnItemLongClickListener()
public void setOnItemSelectedListener(AdapterView.OnItemSelectedListener listener)
listener - The callback that will runpublic final AdapterView.OnItemSelectedListener getOnItemSelectedListener()
public abstract T getAdapter()
public abstract void setAdapter(T adapter)
adapter - The adapter to use to create this view's content.public void addView(View child)
addView in class ViewGroupchild - Ignored.
UnsupportedOperationException - Every time this method is invoked.ViewGroup.generateDefaultLayoutParams()
public void addView(View child,
int index)
addView in class ViewGroupchild - Ignored.index - Ignored.
UnsupportedOperationException - Every time this method is invoked.ViewGroup.generateDefaultLayoutParams()
public void addView(View child,
ViewGroup.LayoutParams params)
addView in interface ViewManageraddView in class ViewGroupchild - Ignored.params - Ignored.
UnsupportedOperationException - Every time this method is invoked.
public void addView(View child,
int index,
ViewGroup.LayoutParams params)
addView in class ViewGroupchild - Ignored.index - Ignored.params - Ignored.
UnsupportedOperationException - Every time this method is invoked.public void removeView(View child)
removeView in interface ViewManagerremoveView in class ViewGroupchild - Ignored.
UnsupportedOperationException - Every time this method is invoked.public void removeViewAt(int index)
removeViewAt in class ViewGroupindex - Ignored.
UnsupportedOperationException - Every time this method is invoked.public void removeAllViews()
removeAllViews in class ViewGroupUnsupportedOperationException - Every time this method is invoked.
protected void onLayout(boolean changed,
int left,
int top,
int right,
int bottom)
ViewGroup
onLayout in class ViewGroupchanged - This is a new size or position for this viewleft - Left position, relative to parenttop - Top position, relative to parentright - Right position, relative to parentbottom - Bottom position, relative to parentpublic int getSelectedItemPosition()
INVALID_POSITION if there is nothing selected.public long getSelectedItemId()
INVALID_ROW_ID
if nothing is selected.public abstract View getSelectedView()
public Object getSelectedItem()
public int getCount()
public int getPositionForView(View view)
view - an adapter item, or a descendant of an adapter item. This must be visible in this
AdapterView at the time of the call.
INVALID_POSITION
if the view does not correspond to a list item (or it is not currently visible).public int getFirstVisiblePosition()
public int getLastVisiblePosition()
public abstract void setSelection(int position)
position - Index (starting at 0) of the data item to be selected.public void setEmptyView(View emptyView)
public View getEmptyView()
boolean isInFilterMode()
public void setFocusable(boolean focusable)
View
setFocusable in class Viewfocusable - If true, this view can receive the focus.View.setFocusableInTouchMode(boolean)public void setFocusableInTouchMode(boolean focusable)
View
setFocusableInTouchMode in class Viewfocusable - If true, this view can receive the focus while
in touch mode.View.setFocusable(boolean)void checkFocus()
public Object getItemAtPosition(int position)
position - Which data to get
public long getItemIdAtPosition(int position)
public void setOnClickListener(View.OnClickListener l)
View
setOnClickListener in class Viewl - The callback that will runView.setClickable(boolean)protected void dispatchSaveInstanceState(SparseArray<Parcelable> container)
dispatchSaveInstanceState in class ViewGroupcontainer - The SparseArray in which to save the view's state.View.dispatchRestoreInstanceState(android.util.SparseArray) ,
View.saveHierarchyState(android.util.SparseArray) ,
View.onSaveInstanceState()protected void dispatchRestoreInstanceState(SparseArray<Parcelable> container)
dispatchRestoreInstanceState in class ViewGroupcontainer - The SparseArray which holds previously saved state.View.dispatchSaveInstanceState(android.util.SparseArray) ,
View.restoreHierarchyState(android.util.SparseArray) ,
View.onRestoreInstanceState(android.os.Parcelable)void selectionChanged()
protected boolean canAnimate()
ViewGroup
canAnimate in class ViewGroupvoid handleDataChanged()
void checkSelectionChanged()
int findSyncPosition()
INVALID_POSITION if it can't
be found
int lookForSelectablePosition(int position,
boolean lookDown)
position - The starting position to look at.lookDown - Whether to look down for other positions.
INVALID_POSITION if nothing can be found.void setSelectedPositionInt(int position)
position - Our current positionvoid setNextSelectedPositionInt(int position)
position - Intended value for mSelectedPosition the next time we go
through layoutvoid rememberSyncState()
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||