public class Spinner extends AbsSpinner implements DialogInterface.OnClickListener
AdapterView.AdapterContextMenuInfo, AdapterView.OnItemClickListener, AdapterView.OnItemLongClickListener, AdapterView.OnItemSelectedListener
ViewGroup.LayoutParams, ViewGroup.MarginLayoutParams, ViewGroup.OnHierarchyChangeListener
View.AccessibilityDelegate, View.BaseSavedState, View.DragShadowBuilder, View.MeasureSpec, View.OnAttachStateChangeListener, View.OnClickListener, View.OnCreateContextMenuListener, View.OnDragListener, View.OnFocusChangeListener, View.OnGenericMotionListener, View.OnHoverListener, View.OnKeyListener, View.OnLayoutChangeListener, View.OnLongClickListener, View.OnSystemUiVisibilityChangeListener, View.OnTouchListener
Modifier and Type | Field and Description |
---|---|
static int |
MODE_DIALOG
Use a dialog window for selecting spinner options.
|
static int |
MODE_DROPDOWN
Use a dropdown anchored to the Spinner for selecting spinner options.
|
INVALID_POSITION, INVALID_ROW_ID, ITEM_VIEW_TYPE_HEADER_OR_FOOTER, ITEM_VIEW_TYPE_IGNORE
CLIP_BOUNDS, CLIP_TO_PADDING_MASK, FLAG_DISALLOW_INTERCEPT, FLAG_SUPPORT_STATIC_TRANSFORMATIONS, FLAG_USE_CHILD_DRAWING_ORDER, FOCUS_AFTER_DESCENDANTS, FOCUS_BEFORE_DESCENDANTS, FOCUS_BLOCK_DESCENDANTS, mDisappearingChildren, mGroupFlags, mOnHierarchyChangeListener, mPersistentDrawingCache, OPTICAL_BOUNDS, PERSISTENT_ALL_CACHES, PERSISTENT_ANIMATION_CACHE, PERSISTENT_NO_CACHE, PERSISTENT_SCROLLING_CACHE
ALPHA, DEBUG_LAYOUT_PROPERTY, DRAG_FLAG_GLOBAL, 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, FIND_VIEWS_WITH_ACCESSIBILITY_NODE_PROVIDERS, FIND_VIEWS_WITH_CONTENT_DESCRIPTION, FIND_VIEWS_WITH_TEXT, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSABLES_ALL, FOCUSABLES_TOUCH_MODE, FOCUSED_SELECTED_STATE_SET, FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, FOCUSED_STATE_SET, FOCUSED_WINDOW_FOCUSED_STATE_SET, GONE, HAPTIC_FEEDBACK_ENABLED, IMPORTANT_FOR_ACCESSIBILITY_AUTO, IMPORTANT_FOR_ACCESSIBILITY_NO, IMPORTANT_FOR_ACCESSIBILITY_YES, INVISIBLE, KEEP_SCREEN_ON, LAYER_TYPE_HARDWARE, LAYER_TYPE_NONE, LAYER_TYPE_SOFTWARE, LAYOUT_DIRECTION_INHERIT, LAYOUT_DIRECTION_LOCALE, LAYOUT_DIRECTION_LTR, LAYOUT_DIRECTION_RTL, mBottom, mCachingFailed, mContext, mCurrentAnimation, MEASURED_HEIGHT_STATE_SHIFT, MEASURED_SIZE_MASK, MEASURED_STATE_MASK, MEASURED_STATE_TOO_SMALL, mInputEventConsistencyVerifier, mLayoutParams, mLeft, mPaddingBottom, mPaddingLeft, mPaddingRight, mPaddingTop, mParent, mRight, mScrollX, mScrollY, mTag, mTop, mUserPaddingBottom, mUserPaddingLeft, mUserPaddingRight, NO_ID, OVER_SCROLL_ALWAYS, OVER_SCROLL_IF_CONTENT_SCROLLS, OVER_SCROLL_NEVER, 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_FOCUSED_SELECTED_STATE_SET, PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_STATE_SET, PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_SELECTED_STATE_SET, PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_STATE_SET, PRESSED_WINDOW_FOCUSED_STATE_SET, PUBLIC_STATUS_BAR_VISIBILITY_MASK, ROTATION, ROTATION_X, ROTATION_Y, SCALE_X, SCALE_Y, SCREEN_STATE_OFF, SCREEN_STATE_ON, SCROLLBAR_POSITION_DEFAULT, SCROLLBAR_POSITION_LEFT, SCROLLBAR_POSITION_RIGHT, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SELECTED_STATE_SET, SELECTED_WINDOW_FOCUSED_STATE_SET, SOUND_EFFECTS_ENABLED, STATUS_BAR_DISABLE_BACK, STATUS_BAR_DISABLE_CLOCK, STATUS_BAR_DISABLE_EXPAND, STATUS_BAR_DISABLE_HOME, STATUS_BAR_DISABLE_NOTIFICATION_ALERTS, STATUS_BAR_DISABLE_NOTIFICATION_ICONS, STATUS_BAR_DISABLE_NOTIFICATION_TICKER, STATUS_BAR_DISABLE_RECENT, STATUS_BAR_DISABLE_SEARCH, STATUS_BAR_DISABLE_SYSTEM_INFO, STATUS_BAR_HIDDEN, STATUS_BAR_VISIBLE, SYSTEM_UI_CLEARABLE_FLAGS, SYSTEM_UI_FLAG_FULLSCREEN, SYSTEM_UI_FLAG_HIDE_NAVIGATION, SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN, SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION, SYSTEM_UI_FLAG_LAYOUT_STABLE, SYSTEM_UI_FLAG_LOW_PROFILE, SYSTEM_UI_FLAG_VISIBLE, SYSTEM_UI_LAYOUT_FLAGS, TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_GRAVITY, TEXT_ALIGNMENT_INHERIT, TEXT_ALIGNMENT_TEXT_END, TEXT_ALIGNMENT_TEXT_START, TEXT_ALIGNMENT_VIEW_END, TEXT_ALIGNMENT_VIEW_START, TEXT_DIRECTION_ANY_RTL, TEXT_DIRECTION_FIRST_STRONG, TEXT_DIRECTION_INHERIT, TEXT_DIRECTION_LOCALE, TEXT_DIRECTION_LTR, TEXT_DIRECTION_RTL, TRANSLATION_X, TRANSLATION_Y, VIEW_LOG_TAG, VISIBLE, WINDOW_FOCUSED_STATE_SET, X, Y
Constructor and Description |
---|
Spinner(Context context)
Construct a new spinner with the given context's theme.
|
Spinner(Context context,
AttributeSet attrs)
Construct a new spinner with the given context's theme and the supplied attribute set.
|
Spinner(Context context,
AttributeSet attrs,
int defStyle)
Construct a new spinner with the given context's theme, the supplied attribute set,
and default style.
|
Spinner(Context context,
AttributeSet attrs,
int defStyle,
int mode)
Construct a new spinner with the given context's theme, the supplied attribute set,
and default style.
|
Spinner(Context context,
int mode)
Construct a new spinner with the given context's theme and the supplied
mode of displaying choices.
|
Modifier and Type | Method and Description |
---|---|
int |
getBaseline()
Return the offset of the widget's text baseline from the widget's top
boundary.
|
int |
getDropDownHorizontalOffset()
Get the configured horizontal offset in pixels for the spinner's popup window of choices.
|
int |
getDropDownVerticalOffset()
Get the configured vertical offset in pixels for the spinner's popup window of choices.
|
int |
getDropDownWidth()
Get the configured width of the spinner's popup window of choices in pixels.
|
int |
getGravity()
Describes how the selected item view is positioned.
|
Drawable |
getPopupBackground()
Get the background drawable for the spinner's popup window of choices.
|
CharSequence |
getPrompt() |
void |
onClick(DialogInterface dialog,
int which)
This method will be invoked when a button in the dialog is clicked.
|
protected void |
onDetachedFromWindow()
This is called when the view is detached from a window.
|
void |
onInitializeAccessibilityEvent(AccessibilityEvent event)
Initializes an
AccessibilityEvent with information about
this View which is the event source. |
void |
onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info)
Initializes an
AccessibilityNodeInfo with information about this view. |
protected void |
onLayout(boolean changed,
int l,
int t,
int r,
int b)
Called from layout when this view should
assign a size and position to each of its children.
|
protected void |
onMeasure(int widthMeasureSpec,
int heightMeasureSpec)
Measure the view and its content to determine the measured width and the
measured height.
|
boolean |
performClick()
Call this view's OnClickListener, if it is defined.
|
void |
setAdapter(SpinnerAdapter adapter)
The Adapter is used to provide the data which backs this Spinner.
|
void |
setDropDownHorizontalOffset(int pixels)
Set a horizontal offset in pixels for the spinner's popup window of choices.
|
void |
setDropDownVerticalOffset(int pixels)
Set a vertical offset in pixels for the spinner's popup window of choices.
|
void |
setDropDownWidth(int pixels)
Set the width of the spinner's popup window of choices in pixels.
|
void |
setEnabled(boolean enabled)
Set the enabled state of this view.
|
void |
setGravity(int gravity)
Describes how the selected item view is positioned.
|
void |
setOnItemClickListener(AdapterView.OnItemClickListener l)
A spinner does not support item click events.
|
void |
setOnItemClickListenerInt(AdapterView.OnItemClickListener l) |
void |
setPopupBackgroundDrawable(Drawable background)
Set the background drawable for the spinner's popup window of choices.
|
void |
setPopupBackgroundResource(int resId)
Set the background drawable for the spinner's popup window of choices.
|
void |
setPrompt(CharSequence prompt)
Sets the prompt to display when the dialog is shown.
|
void |
setPromptId(int promptId)
Sets the prompt to display when the dialog is shown.
|
generateDefaultLayoutParams, getAdapter, getCount, getSelectedView, onRestoreInstanceState, onSaveInstanceState, pointToPosition, requestLayout, setSelection, setSelection
addView, addView, addView, addView, canAnimate, dispatchPopulateAccessibilityEvent, dispatchRestoreInstanceState, dispatchSaveInstanceState, getEmptyView, getFirstVisiblePosition, getItemAtPosition, getItemIdAtPosition, getLastVisiblePosition, getOnItemClickListener, getOnItemLongClickListener, getOnItemSelectedListener, getPositionForView, getSelectedItem, getSelectedItemId, getSelectedItemPosition, onRequestSendAccessibilityEvent, performItemClick, removeAllViews, removeView, removeViewAt, setEmptyView, setFocusable, setFocusableInTouchMode, setOnClickListener, setOnItemLongClickListener, setOnItemSelectedListener
addChildrenForAccessibility, addFocusables, addStatesFromChildren, addTouchables, addView, addViewInLayout, addViewInLayout, attachLayoutAnimationParameters, attachViewToParent, bringChildToFront, checkLayoutParams, childAccessibilityStateChanged, childDrawableStateChanged, childHasTransientStateChanged, cleanupLayoutState, clearChildFocus, clearDisappearingChildren, clearFocus, debug, detachAllViewsFromParent, detachViewFromParent, detachViewFromParent, detachViewsFromParent, dispatchConfigurationChanged, dispatchDisplayHint, dispatchDragEvent, dispatchDraw, dispatchFinishTemporaryDetach, dispatchFreezeSelfOnly, dispatchGenericFocusedEvent, dispatchGenericPointerEvent, dispatchGetDisplayList, dispatchHoverEvent, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchSetActivated, dispatchSetPressed, dispatchSetSelected, dispatchStartTemporaryDetach, dispatchSystemUiVisibilityChanged, dispatchThawSelfOnly, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchVisibilityChanged, dispatchWindowFocusChanged, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, drawableStateChanged, drawChild, endViewTransition, findFocus, findViewByPredicateTraversal, findViewsWithText, findViewTraversal, findViewWithTagTraversal, fitSystemWindows, focusableViewAvailable, focusSearch, gatherTransparentRegion, generateLayoutParams, generateLayoutParams, getChildAt, getChildCount, getChildDrawingOrder, getChildMeasureSpec, getChildStaticTransformation, getChildVisibleRect, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getLayoutMode, getLayoutTransition, getPersistentDrawingCache, hasFocus, hasFocusable, hasHoveredChild, hasTransientState, indexOfChild, internalSetPadding, invalidateChild, invalidateChildFast, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isChildrenDrawingOrderEnabled, isChildrenDrawnWithCacheEnabled, isMotionEventSplittingEnabled, isTransformedTouchPointInView, jumpDrawablesToCurrentState, layout, makeOptionalFitsSystemWindows, measureChild, measureChildren, measureChildWithMargins, offsetChildrenTopAndBottom, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onAnimationEnd, onAnimationStart, onChildVisibilityChanged, onCreateDrawableState, onDebugDraw, onDebugDrawMargins, onInterceptHoverEvent, onInterceptTouchEvent, onRequestFocusInDescendants, onSetLayoutParams, onViewAdded, onViewRemoved, recomputeViewAttributes, removeAllViewsInLayout, removeDetachedView, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestChildRectangleOnScreen, requestDisallowInterceptTouchEvent, requestFocus, requestSendAccessibilityEvent, requestTransitionStart, requestTransparentRegion, resetAccessibilityStateChanged, resetResolvedDrawables, resetResolvedLayoutDirection, resetResolvedPadding, resetResolvedTextAlignment, resetResolvedTextDirection, resetRtlProperties, resolveDrawables, resolveLayoutDirection, resolveLayoutParams, resolvePadding, resolveRtlPropertiesIfNeeded, resolveTextAlignment, resolveTextDirection, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setChildrenDrawingCacheEnabled, setChildrenDrawingOrderEnabled, setChildrenDrawnWithCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setLayoutMode, setLayoutTransition, setMotionEventSplittingEnabled, setOnHierarchyChangeListener, setPersistentDrawingCache, setStaticTransformationsEnabled, shouldDelayChildPressedState, showContextMenuForChild, startActionModeForChild, startLayoutAnimation, startViewTransition, updateViewLayout
addFocusables, addOnAttachStateChangeListener, addOnLayoutChangeListener, animate, announceForAccessibility, applyDrawableToTransparentRegion, awakenScrollBars, awakenScrollBars, awakenScrollBars, bringToFront, buildDrawingCache, buildDrawingCache, buildLayer, callOnClick, cancelLongPress, canHaveDisplayList, canResolveLayoutDirection, canScrollHorizontally, canScrollVertically, checkInputConnectionProxy, clearAccessibilityFocus, clearAnimation, combineMeasuredStates, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeOpaqueFlags, computeScroll, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, createAccessibilityNodeInfo, createContextMenu, debug, debugIndent, destroyDrawingCache, destroyHardwareResources, dispatchGenericMotionEvent, dispatchPointerEvent, draw, findViewById, findViewByPredicate, findViewByPredicateInsideOut, findViewWithTag, fitsSystemWindows, focusSearch, forceLayout, generateViewId, getAccessibilityCursorPosition, getAccessibilityDelegate, getAccessibilityNodeProvider, getAccessibilityViewId, getAccessibilityWindowId, getAlpha, getAnimation, getApplicationWindowToken, getBackground, getBottom, getBottomFadingEdgeStrength, getBottomPaddingOffset, getCameraDistance, getContentDescription, getContext, getContextMenuInfo, getDefaultSize, getDisplay, getDisplayList, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getFadeHeight, getFadeTop, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusables, getFocusedRect, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHardwareRenderer, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getHorizontalScrollFactor, getId, getImportantForAccessibility, getIterableTextForAccessibility, getIteratorForGranularity, getKeepScreenOn, getKeyDispatcherState, getLabelFor, getLayerType, getLayoutDirection, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLeftPaddingOffset, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOpticalInsets, getOverScrollMode, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getParent, getParentForAccessibility, getPivotX, getPivotY, getRawLayoutDirection, getRawTextAlignment, getRawTextDirection, getResources, getRight, getRightFadingEdgeStrength, getRightPaddingOffset, getRootView, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollX, getScrollY, getSolidColor, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getSystemUiVisibility, getTag, getTag, getTextAlignment, getTextDirection, getTop, getTopFadingEdgeStrength, getTopPaddingOffset, getTouchables, getTouchDelegate, getTranslationX, getTranslationY, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollbarWidth, getVerticalScrollFactor, getViewRootImpl, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, hackTurnOffWindowResizeAnim, hasOnClickListeners, hasOpaqueScrollbars, hasOverlappingRendering, hasWindowFocus, includeForAccessibility, inflate, initializeFadingEdge, initializeScrollbars, invalidate, invalidate, invalidate, invalidateDrawable, invalidateParentCaches, invalidateParentIfNeeded, isActionableForAccessibility, isActivated, isClickable, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isImportantForAccessibility, isInEditMode, isInScrollingContainer, isInTouchMode, isLayoutDirectionInherited, isLayoutRequested, isLayoutRtl, isLongClickable, isOpaque, isPaddingOffsetRequired, isPaddingRelative, isPressed, isRootNamespace, isSaveEnabled, isSaveFromParentEnabled, isScrollbarFadingEnabled, isScrollContainer, isSelected, isShown, isSoundEffectsEnabled, isTextAlignmentInherited, isTextDirectionInherited, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, isVerticalScrollBarHidden, isVisibleToUser, isVisibleToUser, measure, mergeDrawableStates, notifyAccessibilityStateChanged, offsetLeftAndRight, offsetTopAndBottom, onAttachedToWindow, onCheckIsTextEditor, onCloseSystemDialogs, onConfigurationChanged, onCreateContextMenu, onCreateInputConnection, onDisplayHint, onDragEvent, onDraw, onDrawHorizontalScrollBar, onDrawScrollBars, onDrawVerticalScrollBar, onFilterTouchEventForSecurity, onFinishInflate, onFinishTemporaryDetach, onFocusChanged, onFocusLost, onGenericMotionEvent, onHoverChanged, onHoverEvent, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onOverScrolled, onPopulateAccessibilityEvent, onResolveDrawables, onRtlPropertiesChanged, onScreenStateChanged, onScrollChanged, onSetAlpha, onSizeChanged, onStartTemporaryDetach, onTouchEvent, onTrackballEvent, onVisibilityChanged, onWindowFocusChanged, onWindowSystemUiVisibilityChanged, onWindowVisibilityChanged, outputDirtyFlags, overScrollBy, performAccessibilityAction, performButtonActionOnTouchDown, performHapticFeedback, performHapticFeedback, performLongClick, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, postInvalidateOnAnimation, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, recomputePadding, refreshDrawableState, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, requestAccessibilityFocus, requestFitSystemWindows, requestFocus, requestFocus, requestFocusFromTouch, requestRectangleOnScreen, requestRectangleOnScreen, resetPaddingToInitialValues, resolveSize, resolveSizeAndState, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAccessibilityCursorPosition, setAccessibilityDelegate, setActivated, setAlpha, setAnimation, setBackground, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setBottom, setCameraDistance, setClickable, setContentDescription, setDisabledSystemUiVisibility, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setFrame, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHovered, setId, setImportantForAccessibility, setIsRootNamespace, setKeepScreenOn, setLabelFor, setLayerPaint, setLayerType, setLayoutDirection, setLayoutInsets, setLayoutParams, setLeft, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnSystemUiVisibilityChangeListener, setOnTouchListener, setOverScrollMode, setPadding, setPaddingRelative, setPivotX, setPivotY, setPressed, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollbarFadingEnabled, setScrollBarSize, setScrollBarStyle, setScrollContainer, setScrollX, setScrollY, setSelected, setSoundEffectsEnabled, setSystemUiVisibility, setTag, setTag, setTagInternal, setTextAlignment, setTextDirection, setTop, setTouchDelegate, setTranslationX, setTranslationY, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarPosition, setVisibility, setWillNotCacheDrawing, setWillNotDraw, setX, setY, showContextMenu, showContextMenu, startActionMode, startAnimation, startDrag, toString, unscheduleDrawable, unscheduleDrawable, verifyDrawable, willNotCacheDrawing, willNotDraw
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
createContextMenu, getParent, getParentForAccessibility, isLayoutRequested, requestFitSystemWindows
public static final int MODE_DIALOG
public static final int MODE_DROPDOWN
public Spinner(Context context)
context
- The Context the view is running in, through which it can
access the current theme, resources, etc.public Spinner(Context context, int mode)
mode
may be one of
MODE_DIALOG
or MODE_DROPDOWN
.context
- The Context the view is running in, through which it can
access the current theme, resources, etc.mode
- Constant describing how the user will select choices from the spinner.MODE_DIALOG
,
MODE_DROPDOWN
public Spinner(Context context, AttributeSet attrs)
context
- The Context the view is running in, through which it can
access the current theme, resources, etc.attrs
- The attributes of the XML tag that is inflating the view.public Spinner(Context context, AttributeSet attrs, int defStyle)
context
- The Context the view is running in, through which it can
access the current theme, resources, etc.attrs
- The attributes of the XML tag that is inflating the view.defStyle
- The default style to apply to this view. If 0, no style
will be applied (beyond what is included in the theme). This may
either be an attribute resource, whose value will be retrieved
from the current theme, or an explicit style resource.public Spinner(Context context, AttributeSet attrs, int defStyle, int mode)
mode
may be one of MODE_DIALOG
or
MODE_DROPDOWN
and determines how the user will select choices from the spinner.context
- The Context the view is running in, through which it can
access the current theme, resources, etc.attrs
- The attributes of the XML tag that is inflating the view.defStyle
- The default style to apply to this view. If 0, no style
will be applied (beyond what is included in the theme). This may
either be an attribute resource, whose value will be retrieved
from the current theme, or an explicit style resource.mode
- Constant describing how the user will select choices from the spinner.MODE_DIALOG
,
MODE_DROPDOWN
public void setPopupBackgroundDrawable(Drawable background)
MODE_DROPDOWN
; this method is a no-op in other modes.background
- Background drawablepublic void setPopupBackgroundResource(int resId)
MODE_DROPDOWN
; this method is a no-op in other modes.resId
- Resource ID of a background drawablepublic Drawable getPopupBackground()
MODE_DROPDOWN
; other modes will return null.public void setDropDownVerticalOffset(int pixels)
MODE_DROPDOWN
; this method is a no-op in other modes.pixels
- Vertical offset in pixelspublic int getDropDownVerticalOffset()
MODE_DROPDOWN
; other modes will return 0.public void setDropDownHorizontalOffset(int pixels)
MODE_DROPDOWN
; this method is a no-op in other modes.pixels
- Horizontal offset in pixelspublic int getDropDownHorizontalOffset()
MODE_DROPDOWN
; other modes will return 0.public void setDropDownWidth(int pixels)
ViewGroup.LayoutParams.MATCH_PARENT
to match the width of the Spinner itself, or
ViewGroup.LayoutParams.WRAP_CONTENT
to wrap to the measured size
of contained dropdown list items.
Only valid in MODE_DROPDOWN
; this method is a no-op in other modes.
pixels
- Width in pixels, WRAP_CONTENT, or MATCH_PARENTpublic int getDropDownWidth()
ViewGroup.LayoutParams.MATCH_PARENT
meaning the popup window will match the width of the Spinner itself, or
ViewGroup.LayoutParams.WRAP_CONTENT
to wrap to the measured size
of contained dropdown list items.public void setEnabled(boolean enabled)
View
setEnabled
in class View
enabled
- True if this view is enabled, false otherwise.public void setGravity(int gravity)
gravity
- See Gravity
public int getGravity()
Gravity
valuepublic void setAdapter(SpinnerAdapter adapter)
AbsSpinner
setAdapter
in class AbsSpinner
adapter
- The SpinnerAdapter to use for this Spinnerpublic int getBaseline()
View
Return the offset of the widget's text baseline from the widget's top boundary. If this widget does not support baseline alignment, this method returns -1.
getBaseline
in class View
protected void onDetachedFromWindow()
View
onDetachedFromWindow
in class AdapterView<SpinnerAdapter>
View.onAttachedToWindow()
public void setOnItemClickListener(AdapterView.OnItemClickListener l)
A spinner does not support item click events. Calling this method will raise an exception.
Instead use AdapterView.setOnItemSelectedListener(android.widget.AdapterView.OnItemSelectedListener)
.
setOnItemClickListener
in class AdapterView<SpinnerAdapter>
l
- this listener will be ignoredpublic void setOnItemClickListenerInt(AdapterView.OnItemClickListener l)
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
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()
).
onMeasure
in class AbsSpinner
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
.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.
protected void onLayout(boolean changed, int l, int t, int r, int b)
ViewGroup
onLayout
in class AdapterView<SpinnerAdapter>
changed
- This is a new size or position for this viewl
- Left position, relative to parentt
- Top position, relative to parentr
- Right position, relative to parentb
- Bottom position, relative to parentCreates and positions all views
public boolean performClick()
View
performClick
in class View
public void onClick(DialogInterface dialog, int which)
DialogInterface.OnClickListener
onClick
in interface DialogInterface.OnClickListener
dialog
- The dialog that received the click.which
- The button that was clicked (e.g.
DialogInterface.BUTTON1
) or the position
of the item clicked.public void onInitializeAccessibilityEvent(AccessibilityEvent event)
View
AccessibilityEvent
with information about
this View which is the event source. In other words, the source of
an accessibility event is the view whose state change triggered firing
the event.
Example: Setting the password property of an event in addition to properties set by the super implementation:
public void onInitializeAccessibilityEvent(AccessibilityEvent event) { super.onInitializeAccessibilityEvent(event); event.setPassword(true); }
If an View.AccessibilityDelegate
has been specified via calling
View.setAccessibilityDelegate(AccessibilityDelegate)
its
View.AccessibilityDelegate.onInitializeAccessibilityEvent(View, AccessibilityEvent)
is responsible for handling this call.
Note: Always call the super implementation before adding information to the event, in case the default implementation has basic information to add.
onInitializeAccessibilityEvent
in class AbsSpinner
event
- The event to initialize.View.sendAccessibilityEvent(int)
,
View.dispatchPopulateAccessibilityEvent(AccessibilityEvent)
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info)
View
AccessibilityNodeInfo
with information about this view.
The base implementation sets:
AccessibilityNodeInfo.setParent(View)
,AccessibilityNodeInfo.setBoundsInParent(Rect)
,AccessibilityNodeInfo.setBoundsInScreen(Rect)
,AccessibilityNodeInfo.setPackageName(CharSequence)
,AccessibilityNodeInfo.setClassName(CharSequence)
,AccessibilityNodeInfo.setContentDescription(CharSequence)
,AccessibilityNodeInfo.setEnabled(boolean)
,AccessibilityNodeInfo.setClickable(boolean)
,AccessibilityNodeInfo.setFocusable(boolean)
,AccessibilityNodeInfo.setFocused(boolean)
,AccessibilityNodeInfo.setLongClickable(boolean)
,AccessibilityNodeInfo.setSelected(boolean)
,Subclasses should override this method, call the super implementation, and set additional attributes.
If an View.AccessibilityDelegate
has been specified via calling
View.setAccessibilityDelegate(AccessibilityDelegate)
its
View.AccessibilityDelegate.onInitializeAccessibilityNodeInfo(View, AccessibilityNodeInfo)
is responsible for handling this call.
onInitializeAccessibilityNodeInfo
in class AbsSpinner
info
- The instance to initialize.public void setPrompt(CharSequence prompt)
prompt
- the prompt to setpublic void setPromptId(int promptId)
promptId
- the resource ID of the prompt to display when the dialog is shownpublic CharSequence getPrompt()