Build 1.0_r1(from source)

android.widget
Class AbsSpinner

java.lang.Object
  extended by android.view.View
      extended by android.view.ViewGroup
          extended by android.widget.AdapterView<SpinnerAdapter>
              extended by android.widget.AbsSpinner
All Implemented Interfaces:
Drawable.Callback, KeyEvent.Callback, ViewManager, ViewParent
Direct Known Subclasses:
Gallery, Spinner

public abstract class AbsSpinner
extends AdapterView<SpinnerAdapter>

An abstract base class for spinner widgets. SDK users will probably not need to use this class.


Nested Class Summary
(package private)  class AbsSpinner.RecycleBin
           
(package private) static class AbsSpinner.SavedState
           
 
Nested classes/interfaces inherited from class android.widget.AdapterView
AdapterView.AdapterContextMenuInfo, AdapterView.AdapterDataSetObserver, AdapterView.OnItemClickListener, AdapterView.OnItemLongClickListener, AdapterView.OnItemSelectedListener
 
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
(package private)  SpinnerAdapter mAdapter
           
(package private)  boolean mBlockLayoutRequests
           
(package private)  int mHeightMeasureSpec
           
(package private)  Interpolator mInterpolator
           
(package private)  AbsSpinner.RecycleBin mRecycler
           
(package private)  View mSelectedView
           
(package private)  int mSelectionBottomPadding
           
(package private)  int mSelectionLeftPadding
           
(package private)  int mSelectionRightPadding
           
(package private)  int mSelectionTopPadding
           
(package private)  Rect mSpinnerPadding
           
(package private)  int mWidthMeasureSpec
           
 
Fields inherited from class android.widget.AdapterView
INVALID_POSITION, INVALID_ROW_ID, ITEM_VIEW_TYPE_HEADER_OR_FOOTER, ITEM_VIEW_TYPE_IGNORE, mDataChanged, mEmptyView, mFirstPosition, mInLayout, mItemCount, mNeedSync, mNextSelectedPosition, mNextSelectedRowId, mOldItemCount, mOldSelectedPosition, mOldSelectedRowId, mOnItemClickListener, mOnItemLongClickListener, mOnItemSelectedListener, mSelectedPosition, mSelectedRowId, mSpecificTop, mSyncHeight, mSyncMode, mSyncPosition, mSyncRowId, SYNC_FIRST_POSITION, SYNC_MAX_DURATION_MILLIS, SYNC_SELECTED_POSITION
 
Fields inherited from class android.view.ViewGroup
CLIP_TO_PADDING_MASK, FLAG_SUPPORT_STATIC_TRANSFORMATIONS, FLAG_USE_CHILD_DRAWING_ORDER, FOCUS_AFTER_DESCENDANTS, FOCUS_BEFORE_DESCENDANTS, FOCUS_BLOCK_DESCENDANTS, mDisappearingChildren, mGroupFlags, mOnHierarchyChangeListener, mPersistentDrawingCache, PERSISTENT_ALL_CACHES, PERSISTENT_ANIMATION_CACHE, PERSISTENT_NO_CACHE, PERSISTENT_SCROLLING_CACHE
 
Fields inherited from class android.view.View
DRAWING_CACHE_QUALITY_AUTO, DRAWING_CACHE_QUALITY_HIGH, DRAWING_CACHE_QUALITY_LOW, EMPTY_STATE_SET, ENABLED_FOCUSED_SELECTED_STATE_SET, ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_FOCUSED_STATE_SET, ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, ENABLED_SELECTED_STATE_SET, ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_STATE_SET, ENABLED_WINDOW_FOCUSED_STATE_SET, FIRST_STATE_SET, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSED_SELECTED_STATE_SET, FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, FOCUSED_STATE_SET, FOCUSED_WINDOW_FOCUSED_STATE_SET, GONE, INVISIBLE, KEEP_SCREEN_ON, LAST_STATE_SET, mBottom, mContext, mCurrentAnimation, MIDDLE_STATE_SET, mLayoutParams, mLeft, mLocation, mMeasuredHeight, mMeasuredWidth, mOnClickListener, mOnCreateContextMenuListener, mOnFocusChangeListener, mOnLongClickListener, mPaddingBottom, mPaddingLeft, mPaddingRight, mPaddingTop, mParent, mRight, mScrollX, mScrollY, mTag, mTop, NO_ID, PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET, PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_SELECTED_STATE_SET, PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_STATE_SET, PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET, PRESSED_FIRST_STATE_SET, PRESSED_FOCUSED_SELECTED_STATE_SET, PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_STATE_SET, PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_LAST_STATE_SET, PRESSED_MIDDLE_STATE_SET, PRESSED_SELECTED_STATE_SET, PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_SINGLE_STATE_SET, PRESSED_STATE_SET, PRESSED_WINDOW_FOCUSED_STATE_SET, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SELECTED_STATE_SET, SELECTED_WINDOW_FOCUSED_STATE_SET, SINGLE_STATE_SET, SOUND_EFFECTS_ENABLED, VIEW_LOG_TAG, VISIBLE, WINDOW_FOCUSED_STATE_SET
 
Constructor Summary
AbsSpinner(Context context)
           
AbsSpinner(Context context, AttributeSet attrs)
           
AbsSpinner(Context context, AttributeSet attrs, int defStyle)
           
 
Method Summary
protected  ViewGroup.LayoutParams generateDefaultLayoutParams()
          Returns a set of default layout parameters.
 SpinnerAdapter getAdapter()
          Returns the adapter currently associated with this widget.
(package private)  int getChildHeight(View child)
           
(package private)  int getChildWidth(View child)
           
 int getCount()
           
 View getSelectedView()
           
(package private)  void handleDataChanged()
           
(package private) abstract  void layout(int delta, boolean animate)
           
protected  void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
           Measure the view and its content to determine the measured width and the measured height.
 void onRestoreInstanceState(Parcelable state)
          Hook allowing a view to re-apply a representation of its internal state that had previously been generated by View.onSaveInstanceState().
 Parcelable onSaveInstanceState()
          Hook allowing a view to generate a representation of its internal state that can later be used to create a new instance with that same state.
 int pointToPosition(int x, int y)
          Maps a point to a position in the list.
(package private)  void recycleAllViews()
           
 void requestLayout()
          Override to prevent spamming ourselves with layout requests as we place views
(package private)  void resetList()
          Clear out all children from the list
 void setAdapter(SpinnerAdapter adapter)
          The Adapter is used to provide the data which backs this Spinner.
 void setSelection(int position)
          Sets the currently selected item
 void setSelection(int position, boolean animate)
          Jump directly to a specific item in the adapter data.
(package private)  void setSelectionInt(int position, boolean animate)
          Makes the item at the supplied position selected.
 
Methods inherited from class android.widget.AdapterView
addView, addView, addView, addView, canAnimate, checkFocus, checkSelectionChanged, dispatchRestoreInstanceState, dispatchSaveInstanceState, findSyncPosition, getEmptyView, getFirstVisiblePosition, getItemAtPosition, getItemIdAtPosition, getLastVisiblePosition, getOnItemClickListener, getOnItemLongClickListener, getOnItemSelectedListener, getPositionForView, getSelectedItem, getSelectedItemId, getSelectedItemPosition, isInFilterMode, lookForSelectablePosition, onLayout, performItemClick, rememberSyncState, removeAllViews, removeView, removeViewAt, selectionChanged, setEmptyView, setFocusable, setFocusableInTouchMode, setNextSelectedPositionInt, setOnClickListener, setOnItemClickListener, setOnItemLongClickListener, setOnItemSelectedListener, setSelectedPositionInt
 
Methods inherited from class android.view.ViewGroup
addFocusables, addStatesFromChildren, addTouchables, addView, addViewInLayout, addViewInLayout, attachLayoutAnimationParameters, attachViewToParent, bringChildToFront, checkLayoutParams, childDrawableStateChanged, cleanupLayoutState, clearChildFocus, clearDisappearingChildren, clearFocus, debug, detachAllViewsFromParent, detachViewFromParent, detachViewFromParent, detachViewsFromParent, dispatchDraw, dispatchFreezeSelfOnly, dispatchKeyEvent, dispatchSetPressed, dispatchSetSelected, dispatchThawSelfOnly, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchWindowFocusChanged, dispatchWindowVisibilityChanged, drawableStateChanged, drawChild, findFocus, findViewTraversal, findViewWithTagTraversal, fitSystemWindows, focusableViewAvailable, focusSearch, gatherTransparentRegion, generateLayoutParams, generateLayoutParams, getChildAt, getChildCount, getChildDrawingOrder, getChildMeasureSpec, getChildStaticTransformation, getChildVisibleRect, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getPersistentDrawingCache, hasFocus, hasFocusable, indexOfChild, invalidateChild, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isChildrenDrawnWithCacheEnabled, measureChild, measureChildren, measureChildWithMargins, offsetChildrenTopAndBottom, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onAnimationEnd, onAnimationStart, onCreateDrawableState, onInterceptTouchEvent, onRequestFocusInDescendants, recomputeViewAttributes, removeAllViewsInLayout, removeDetachedView, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestChildRectangleOnScreen, requestDisallowInterceptTouchEvent, requestFocus, requestTransparentRegion, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setChildrenDrawingCacheEnabled, setChildrenDrawnWithCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setOnHierarchyChangeListener, setPadding, setPersistentDrawingCache, showContextMenuForChild, startLayoutAnimation, updateViewLayout
 
Methods inherited from class android.view.View
applyDrawableToTransparentRegion, bringToFront, buildDrawingCache, cancelLongPress, clearAnimation, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeScroll, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, createContextMenu, debug, debugIndent, destroyDrawingCache, dispatchKeyShortcutEvent, draw, finalize, findViewById, findViewWithTag, focusSearch, forceLayout, getAnimation, getApplicationWindowToken, getBackground, getBaseline, getBottom, getBottomFadingEdgeStrength, getContext, getContextMenuInfo, getDefaultSize, getDrawableState, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getFocusables, getFocusedRect, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getId, getKeepScreenOn, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMeasuredHeight, getMeasuredWidth, getNextFocusDownId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getParent, getResources, getRight, getRightFadingEdgeStrength, getRootView, getScrollBarStyle, getScrollX, getScrollY, getSolidColor, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getTag, getTop, getTopFadingEdgeStrength, getTouchables, getTouchDelegate, getVerticalFadingEdgeLength, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowToken, getWindowVisibility, hasWindowFocus, inflate, initializeFadingEdge, initializeScrollbars, invalidate, invalidate, invalidate, invalidateDrawable, isClickable, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isInTouchMode, isLayoutRequested, isLongClickable, isPressed, isRootNamespace, isSaveEnabled, isSelected, isShown, isSoundEffectsEnabled, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, layout, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onAttachedToWindow, onCreateContextMenu, onDetachedFromWindow, onDraw, onFinishInflate, onFocusChanged, onKeyDown, onKeyMultiple, onKeyShortcut, onKeyUp, onScrollChanged, onSetAlpha, onSizeChanged, onTouchEvent, onTrackballEvent, onWindowFocusChanged, onWindowVisibilityChanged, performClick, performLongClick, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, refreshDrawableState, removeCallbacks, requestFocus, requestFocus, requestFocusFromTouch, requestRectangleOnScreen, requestRectangleOnScreen, resolveSize, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, setAnimation, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setClickable, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setEnabled, setFadingEdgeLength, setFrame, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setId, setIsRootNamespace, setKeepScreenOn, setLayoutParams, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNextFocusDownId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnCreateContextMenuListener, setOnFocusChangeListener, setOnKeyListener, setOnLongClickListener, setOnTouchListener, setPressed, setSaveEnabled, setScrollBarStyle, setSelected, setSoundEffectsEnabled, setTag, setTouchDelegate, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVisibility, setWillNotCacheDrawing, setWillNotDraw, showContextMenu, startAnimation, unscheduleDrawable, unscheduleDrawable, verifyDrawable, willNotCacheDrawing, willNotDraw
 
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
 

Field Detail

mAdapter

SpinnerAdapter mAdapter

mHeightMeasureSpec

int mHeightMeasureSpec

mWidthMeasureSpec

int mWidthMeasureSpec

mBlockLayoutRequests

boolean mBlockLayoutRequests

mSelectionLeftPadding

int mSelectionLeftPadding

mSelectionTopPadding

int mSelectionTopPadding

mSelectionRightPadding

int mSelectionRightPadding

mSelectionBottomPadding

int mSelectionBottomPadding

mSpinnerPadding

Rect mSpinnerPadding

mSelectedView

View mSelectedView

mInterpolator

Interpolator mInterpolator

mRecycler

AbsSpinner.RecycleBin mRecycler
Constructor Detail

AbsSpinner

public AbsSpinner(Context context)

AbsSpinner

public AbsSpinner(Context context,
                  AttributeSet attrs)

AbsSpinner

public AbsSpinner(Context context,
                  AttributeSet attrs,
                  int defStyle)
Method Detail

setAdapter

public void setAdapter(SpinnerAdapter adapter)
The Adapter is used to provide the data which backs this Spinner. It also provides methods to transform spinner items based on their position relative to the selected item.

Specified by:
setAdapter in class AdapterView<SpinnerAdapter>
Parameters:
adapter - The SpinnerAdapter to use for this Spinner

resetList

void resetList()
Clear out all children from the list


onMeasure

protected void onMeasure(int widthMeasureSpec,
                         int heightMeasureSpec)
Description copied from class: View

Measure the view and its content to determine the measured width and the measured height. This method is invoked by View.measure(int, int) and should be overriden by subclasses to provide accurate and efficient measurement of their contents.

CONTRACT: When overriding this method, you must call View.setMeasuredDimension(int, int) to store the measured width and height of this view. Failure to do so will trigger an IllegalStateException, thrown by View.measure(int, int). Calling the superclass' View.onMeasure(int, int) is a valid use.

The base class implementation of measure defaults to the background size, unless a larger size is allowed by the MeasureSpec. Subclasses should override View.onMeasure(int, int) to provide better measurements of their content.

If this method is overridden, it is the subclass's responsibility to make sure the measured height and width are at least the view's minimum height and width (View.getSuggestedMinimumHeight() and View.getSuggestedMinimumWidth()).

Overrides:
onMeasure in class View
Parameters:
widthMeasureSpec - horizontal space requirements as imposed by the parent. The requirements are encoded with View.MeasureSpec.
heightMeasureSpec - vertical space requirements as imposed by the parent. The requirements are encoded with View.MeasureSpec.
See Also:
Figure out the dimensions of this Spinner. The width comes from the widthMeasureSpec as Spinnners can't have their width set to UNSPECIFIED. The height is based on the height of the selected item plus padding.

getChildHeight

int getChildHeight(View child)

getChildWidth

int getChildWidth(View child)

generateDefaultLayoutParams

protected ViewGroup.LayoutParams generateDefaultLayoutParams()
Description copied from class: ViewGroup
Returns a set of default layout parameters. These parameters are requested when the View passed to ViewGroup.addView(View) has no layout parameters already set. If null is returned, an exception is thrown from addView.

Overrides:
generateDefaultLayoutParams in class ViewGroup
Returns:
a set of default layout parameters or null

recycleAllViews

void recycleAllViews()

handleDataChanged

void handleDataChanged()
Overrides:
handleDataChanged in class AdapterView<SpinnerAdapter>

setSelection

public void setSelection(int position,
                         boolean animate)
Jump directly to a specific item in the adapter data.


setSelection

public void setSelection(int position)
Description copied from class: AdapterView
Sets the currently selected item

Specified by:
setSelection in class AdapterView<SpinnerAdapter>
Parameters:
position - Index (starting at 0) of the data item to be selected.

setSelectionInt

void setSelectionInt(int position,
                     boolean animate)
Makes the item at the supplied position selected.

Parameters:
position - Position to select
animate - Should the transition be animated

layout

abstract void layout(int delta,
                     boolean animate)

getSelectedView

public View getSelectedView()
Specified by:
getSelectedView in class AdapterView<SpinnerAdapter>
Returns:
The view corresponding to the currently selected item, or null if nothing is selected

requestLayout

public void requestLayout()
Override to prevent spamming ourselves with layout requests as we place views

Specified by:
requestLayout in interface ViewParent
Overrides:
requestLayout in class View
See Also:
View.requestLayout()

getAdapter

public SpinnerAdapter getAdapter()
Description copied from class: AdapterView
Returns the adapter currently associated with this widget.

Specified by:
getAdapter in class AdapterView<SpinnerAdapter>
Returns:
The adapter used to provide this view's content.

getCount

public int getCount()
Overrides:
getCount in class AdapterView<SpinnerAdapter>
Returns:
The number of items owned by the Adapter associated with this AdapterView. (This is the number of data items, which may be larger than the number of visible view.)

pointToPosition

public int pointToPosition(int x,
                           int y)
Maps a point to a position in the list.

Parameters:
x - X in local coordinate
y - Y in local coordinate
Returns:
The position of the item which contains the specified point, or AdapterView.INVALID_POSITION if the point does not intersect an item.

onSaveInstanceState

public Parcelable onSaveInstanceState()
Description copied from class: View
Hook allowing a view to generate a representation of its internal state that can later be used to create a new instance with that same state. This state should only contain information that is not persistent or can not be reconstructed later. For example, you will never store your current position on screen because that will be computed again when a new instance of the view is placed in its view hierarchy.

Some examples of things you may store here: the current cursor position in a text view (but usually not the text itself since that is stored in a content provider or other persistent storage), the currently selected item in a list view.

Overrides:
onSaveInstanceState in class View
Returns:
Returns a Parcelable object containing the view's current dynamic state, or null if there is nothing interesting to save. The default implementation returns null.
See Also:
View.onRestoreInstanceState(android.os.Parcelable), View.saveHierarchyState(android.util.SparseArray), View.dispatchSaveInstanceState(android.util.SparseArray), View.setSaveEnabled(boolean)

onRestoreInstanceState

public void onRestoreInstanceState(Parcelable state)
Description copied from class: View
Hook allowing a view to re-apply a representation of its internal state that had previously been generated by View.onSaveInstanceState(). This function will never be called with a null state.

Overrides:
onRestoreInstanceState in class View
Parameters:
state - The frozen state that had previously been returned by View.onSaveInstanceState().
See Also:
View.onSaveInstanceState(), View.restoreHierarchyState(android.util.SparseArray), View.dispatchRestoreInstanceState(android.util.SparseArray)

Build 1.0_r1(from source)

Please submit a feedback, bug or feature