Package icyllis.modernui.widget
Class AdapterView<T extends Adapter>
java.lang.Object
icyllis.modernui.view.View
icyllis.modernui.view.ViewGroup
icyllis.modernui.widget.AdapterView<T>
- Type Parameters:
T- the adapter type
- All Implemented Interfaces:
Drawable.Callback,ViewManager,ViewParent
- Direct Known Subclasses:
AbsListView,AbsSpinner
An AdapterView is a view whose children are determined by an
Adapter.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classExtra menu information provided to theView.OnCreateContextMenuListener.onCreateContextMenu(ContextMenu, View, ContextMenu.ContextMenuInfo)callback when a context menu is brought up for this AdapterView.static interfaceInterface definition for a callback to be invoked when an item in this AdapterView has been clicked.static interfaceInterface definition for a callback to be invoked when an item in this view has been clicked and held.static interfaceInterface definition for a callback to be invoked when an item in this view has been selected.Nested classes/interfaces inherited from class icyllis.modernui.view.ViewGroup
ViewGroup.LayoutParams, ViewGroup.MarginLayoutParamsNested classes/interfaces inherited from class icyllis.modernui.view.View
View.DragShadow, View.Focusable, View.FocusableMode, View.FocusDirection, View.FocusRealDirection, View.LayoutDir, View.NestedScrollType, View.OnAttachStateChangeListener, View.OnClickListener, View.OnContextClickListener, View.OnCreateContextMenuListener, View.OnDragListener, View.OnFocusChangeListener, View.OnGenericMotionListener, View.OnHoverListener, View.OnKeyListener, View.OnLayoutChangeListener, View.OnLongClickListener, View.OnScrollChangeListener, View.OnTouchListener, View.ResolvedLayoutDir, View.ScrollAxis, View.ScrollBarStyle, View.ScrollIndicators, View.TextAlignment, View.Visibility -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intRepresents an invalid position.static final longRepresents an empty or invalid row idstatic final intThe item view type returned byAdapter.getItemViewType(int)when the item is a header or footer.static final intThe item view type returned byAdapter.getItemViewType(int)when the adapter does not want the item's view recycled.Fields inherited from class icyllis.modernui.view.ViewGroup
CLIP_TO_PADDING_MASK, FLAG_DISALLOW_INTERCEPT, FOCUS_AFTER_DESCENDANTS, FOCUS_BEFORE_DESCENDANTS, FOCUS_BLOCK_DESCENDANTSFields inherited from class icyllis.modernui.view.View
ALPHA, BOTTOM, 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, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSABLE, FOCUSABLE_AUTO, 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, INVISIBLE, LAYOUT_DIRECTION_INHERIT, LAYOUT_DIRECTION_LOCALE, LAYOUT_DIRECTION_LTR, LAYOUT_DIRECTION_RTL, LAYOUT_DIRECTION_UNDEFINED, LEFT, MEASURED_HEIGHT_STATE_SHIFT, MEASURED_SIZE_MASK, MEASURED_STATE_MASK, MEASURED_STATE_TOO_SMALL, NO_ID, NOT_FOCUSABLE, 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, RIGHT, ROTATION, ROTATION_X, ROTATION_Y, SCALE_X, SCALE_Y, SCROLL_AXIS_HORIZONTAL, SCROLL_AXIS_NONE, SCROLL_AXIS_VERTICAL, SCROLL_INDICATOR_BOTTOM, SCROLL_INDICATOR_END, SCROLL_INDICATOR_LEFT, SCROLL_INDICATOR_RIGHT, SCROLL_INDICATOR_START, SCROLL_INDICATOR_TOP, SCROLL_X, SCROLL_Y, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SELECTED_STATE_SET, SELECTED_WINDOW_FOCUSED_STATE_SET, SOUND_EFFECTS_ENABLED, 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_FIRST_STRONG_LTR, TEXT_DIRECTION_FIRST_STRONG_RTL, TEXT_DIRECTION_INHERIT, TEXT_DIRECTION_LOCALE, TEXT_DIRECTION_LTR, TEXT_DIRECTION_RTL, TOP, TRANSLATION_X, TRANSLATION_Y, TRANSLATION_Z, TYPE_NON_TOUCH, TYPE_TOUCH, VIEW_MARKER, VISIBLE, WINDOW_FOCUSED_STATE_SET, X, Y, Z -
Constructor Summary
ConstructorsConstructorDescriptionAdapterView(Context context) AdapterView(Context context, AttributeSet attrs) AdapterView(Context context, AttributeSet attrs, ResourceId defStyleAttr) AdapterView(Context context, AttributeSet attrs, ResourceId defStyleAttr, ResourceId defStyleRes) -
Method Summary
Modifier and TypeMethodDescriptionvoidThis method is not supported and throws an UnsupportedOperationException when called.voidThis method is not supported and throws an UnsupportedOperationException when called.voidaddView(View child, int index, ViewGroup.LayoutParams params) This method is not supported and throws an UnsupportedOperationException when called.voidaddView(View child, ViewGroup.LayoutParams params) This method is not supported and throws an UnsupportedOperationException when called.abstract TReturns the adapter currently associated with this widget.intgetCount()When the current adapter is empty, the AdapterView can display a special view called the empty view.intReturns the position within the adapter's data set for the first item displayed on screen.getItemAtPosition(int position) Gets the data associated with the specified position in the list.longgetItemIdAtPosition(int position) intReturns the position within the adapter's data set for the last item displayed on screen.intgetPositionForView(View view) Returns 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.longintReturn the position of the currently selected item within the adapter's data setabstract Viewprotected voidThis is called when the view is detached from a window.protected voidonLayout(boolean changed, int left, int top, int right, int bottom) Called fromView.layout(int, int, int, int)when this view should assign a size and position to each of its children.booleanperformItemClick(View view, int position, long id) Call the OnItemClickListener, if it is defined.voidThis method is not supported and throws an UnsupportedOperationException when called.voidremoveView(View child) This method is not supported and throws an UnsupportedOperationException when called.voidremoveViewAt(int index) This method is not supported and throws an UnsupportedOperationException when called.abstract voidsetAdapter(T adapter) Sets the adapter that provides the data and the views to represent the data in this widget.voidsetEmptyView(View emptyView) Sets the view to show if the adapter is emptyvoidsetFocusable(int focusable) Sets whether this view can receive focus.voidsetFocusableInTouchMode(boolean focusable) Set whether this view can receive focus while in touch mode.voidRegister a callback to be invoked when this view is clicked.voidRegister a callback to be invoked when an item in this AdapterView has been clicked.voidRegister a callback to be invoked when an item in this AdapterView has been clicked and heldvoidRegister a callback to be invoked when an item in this AdapterView has been selected.abstract voidsetSelection(int position) Sets the currently selected item.Methods inherited from class icyllis.modernui.view.ViewGroup
addFocusables, addKeyboardNavigationClusters, addStatesFromChildren, addTouchables, addTransientView, addView, addViewInLayout, addViewInLayout, attachViewToParent, bringChildToFront, checkLayoutParams, childDrawableStateChanged, childHasTransientStateChanged, cleanupLayoutState, clearChildFocus, clearDisappearingChildren, clearFocus, detachAllViewsFromParent, detachViewFromParent, detachViewFromParent, detachViewsFromParent, dispatchDraw, dispatchDrawableHotspotChanged, dispatchFinishTemporaryDetach, dispatchGenericPointerEvent, dispatchHoverEvent, dispatchKeyEvent, dispatchKeyShortcutEvent, dispatchSetActivated, dispatchSetPressed, dispatchSetSelected, dispatchStartTemporaryDetach, dispatchTouchEvent, dispatchVisibilityChanged, dispatchWindowFocusChanged, dispatchWindowVisibilityChanged, drawableStateChanged, drawChild, endViewTransition, findFocus, focusableViewAvailable, focusSearch, generateDefaultLayoutParams, generateLayoutParams, getChildAt, getChildCount, getChildDrawingOrder, getChildDrawingOrder, getChildMeasureSpec, getChildVisibleRect, getChildVisibleRect, getClipChildren, getClipToPadding, getDescendantFocusability, getFocusedChild, getLayoutTransition, getNestedScrollAxes, getTouchscreenBlocksFocus, getTransientView, getTransientViewCount, getTransientViewIndex, hasBooleanFlag, hasFocus, hasTransientState, indexOfChild, internalSetPadding, invalidateChild, invalidateChildInParent, isChildrenDrawingOrderEnabled, isLayoutSuppressed, isTransitionGroup, jumpDrawablesToCurrentState, layout, measureChild, measureChildren, measureChildWithMargins, offsetChildrenTopAndBottom, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onChildVisibilityChanged, onCreateDrawableState, onInterceptHoverEvent, onInterceptTouchEvent, onNestedFling, onNestedPreFling, onNestedPreScroll, onNestedScroll, onNestedScrollAccepted, onRequestFocusInDescendants, onResolvePointerIcon, onSetLayoutParams, onStartNestedScroll, onStopNestedScroll, onViewAdded, onViewRemoved, removeAllViewsInLayout, removeDetachedView, removeTransientView, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestChildRectangleOnScreen, requestDisallowInterceptTouchEvent, requestFocus, requestTransitionStart, resetResolvedDrawables, resolveDrawables, resolveLayoutDirection, resolveLayoutParams, resolvePadding, resolveRtlPropertiesIfNeeded, resolveTextAlignment, resolveTextDirection, restoreDefaultFocus, setAddStatesFromChildren, setBooleanFlag, setChildrenDrawingOrderEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutTransition, setShadowAlpha, setTouchscreenBlocksFocus, setTransitionGroup, shouldDelayChildPressedState, showContextMenuForChild, startActionModeForChild, startViewTransition, suppressLayout, transformPointToViewLocal, updateViewLayoutMethods inherited from class icyllis.modernui.view.View
addFocusables, addOnAttachStateChangeListener, addOnLayoutChangeListener, awakenScrollBars, awakenScrollBars, callOnClick, cancelLongPress, cancelPendingInputEvents, canReceivePointerEvents, canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, canScrollHorizontally, canScrollVertically, combineMeasuredStates, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeScroll, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, createContextMenu, dispatchGenericMotionEvent, dispatchNestedFling, dispatchNestedPreFling, dispatchNestedPreScroll, dispatchNestedScroll, dispatchPointerEvent, dp, draw, drawableHotspotChanged, findViewById, findViewByPredicate, findViewByPredicateInsideOut, findViewWithTag, focusSearch, forceHasOverlappingRendering, forceLayout, generateViewId, getAlpha, getAnimationMatrix, getBackground, getBaseline, getBottom, getBoundsOnScreen, getBoundsOnScreen, getClipBounds, getClipBounds, getContentDescription, getContext, getContextMenuInfo, getDefaultSize, getDrawableState, getDrawingRect, getElevation, getFadingEdge, getFadingEdgeLength, getFocusable, getFocusables, getFocusedRect, getForeground, getForegroundGravity, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHasOverlappingRendering, getHeight, getHitRect, getHorizontalScrollbarHeight, getHorizontalScrollbarThumbDrawable, getHorizontalScrollbarTrackDrawable, getId, getInverseMatrix, getKeyDispatcherState, getLayoutDirection, getLayoutParams, getLeft, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextClusterForwardId, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOnLongClickListener, getOutlineProvider, getOverScrollMode, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getParent, getPivotX, getPivotY, getRawLayoutDirection, getRawTextAlignment, getRawTextDirection, getRevealOnFocusHint, getRight, getRootView, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollIndicators, getScrollX, getScrollY, getStateDescription, getStateListAnimator, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getTag, getTag, getTextAlignment, getTextDirection, getTooltipText, getTooltipView, getTop, getTouchables, getTransitionAlpha, getTransitionName, getTranslationX, getTranslationY, getTranslationZ, getVerticalFadingEdgeLength, getVerticalScrollbarThumbDrawable, getVerticalScrollbarTrackDrawable, getVerticalScrollbarWidth, getViewRoot, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowVisibility, getX, getY, getZ, handleScrollBarDragging, hasExplicitFocusable, hasFocusable, hasIdentityMatrix, hasNestedScrollingParent, hasOnClickListeners, hasOnLongClickListeners, hasOverlappingRendering, hasTranslationTransientState, hasWindowFocus, invalidate, invalidate, invalidate, invalidateDrawable, invalidateOutline, isActivated, isAttachedToWindow, isClickable, isContextClickable, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isFocusedByDefault, isForegroundInsidePadding, isHapticFeedbackEnabled, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isInLayout, isInScrollingContainer, isInTouchMode, isKeyboardNavigationCluster, isLaidOut, isLayoutDirectionInherited, isLayoutDirectionResolved, isLayoutRequested, isLayoutRtl, isLongClickable, isNestedScrollingEnabled, isPaddingRelative, isPivotSet, isPressed, isRootNamespace, isScrollbarFadingEnabled, isSelected, isShowingLayoutBounds, isShown, isSoundEffectsEnabled, isTemporarilyDetached, isTextAlignmentInherited, isTextAlignmentResolved, isTextDirectionInherited, isTextDirectionResolved, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, isVerticalScrollBarHidden, keyboardNavigationClusterSearch, mapRectFromViewToScreenCoords, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onAttachedToWindow, onCancelPendingInputEvents, onCreateContextMenu, onDragEvent, onDraw, onDrawForeground, onDrawScrollBars, onFinishTemporaryDetach, onFocusChanged, onGenericMotionEvent, onHoverChanged, onHoverEvent, onKeyDown, onKeyShortcut, onKeyUp, onMeasure, onOverScrolled, onResolveDrawables, onRtlPropertiesChanged, onScrollChanged, onSizeChanged, onStartTemporaryDetach, onTouchEvent, onVisibilityAggregated, onVisibilityChanged, onWindowFocusChanged, onWindowVisibilityChanged, overScrollBy, performButtonActionOnTouchDown, performClick, performContextClick, performContextClick, performHapticFeedback, performHapticFeedback, performLongClick, performLongClick, playSoundEffect, pointInView, post, postDelayed, postInvalidate, postInvalidateDelayed, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, refreshDrawableState, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, requestFocus, requestFocus, requestLayout, requestRectangleOnScreen, requestRectangleOnScreen, requireViewById, resetPivot, resolveSize, resolveSizeAndState, scheduleDrawable, scrollBy, scrollTo, setActivated, setAlpha, setAnimationMatrix, setBackground, setBottom, setClickable, setClipBounds, setContentDescription, setContextClickable, setDuplicateParentStateEnabled, setElevation, setEnabled, setFocusable, setFocusedByDefault, setFocusedInCluster, setForeground, setForegroundGravity, setFrame, setHapticFeedbackEnabled, setHasTransientState, setHasTranslationTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHorizontalScrollbarThumbDrawable, setHorizontalScrollbarTrackDrawable, setHovered, setId, setIsRootNamespace, setKeyboardNavigationCluster, setLayoutDirection, setLayoutParams, setLeft, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNestedScrollingEnabled, setNextClusterForwardId, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnContextClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnScrollChangeListener, setOnTouchListener, setOutlineProvider, setOverScrollMode, setPadding, setPaddingRelative, setPivotX, setPivotY, setPressed, setRevealOnFocusHint, setRight, setRotation, setRotationX, setRotationY, setScaleX, setScaleY, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollbarFadingEnabled, setScrollBarSize, setScrollBarStyle, setScrollIndicators, setScrollIndicators, setScrollX, setScrollY, setSelected, setSoundEffectsEnabled, setStateDescription, setStateListAnimator, setTag, setTag, setTextAlignment, setTextDirection, setTooltipText, setTop, setTransitionAlpha, setTransitionName, setTransitionVisibility, setTranslationX, setTranslationY, setTranslationZ, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarThumbDrawable, setVerticalScrollbarTrackDrawable, setVisibility, setWillNotDraw, setX, setY, setZ, showContextMenu, showContextMenu, sp, startActionMode, startActionMode, startDragAndDrop, startNestedScroll, stopNestedScroll, toGlobalMotionEvent, toLocalMotionEvent, toString, transformFromViewToWindowSpace, transformMatrixToGlobal, transformMatrixToLocal, unscheduleDrawable, unscheduleDrawable, verifyDrawable, willNotDrawMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface icyllis.modernui.view.ViewParent
canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, createContextMenu, getLayoutDirection, getParent, getTextAlignment, getTextDirection, isLayoutDirectionResolved, isLayoutRequested, isTextAlignmentResolved, isTextDirectionResolved, keyboardNavigationClusterSearch, requestLayout
-
Field Details
-
ITEM_VIEW_TYPE_IGNORE
public static final int ITEM_VIEW_TYPE_IGNOREThe item view type returned byAdapter.getItemViewType(int)when the adapter does not want the item's view recycled.- See Also:
-
ITEM_VIEW_TYPE_HEADER_OR_FOOTER
public static final int ITEM_VIEW_TYPE_HEADER_OR_FOOTERThe item view type returned byAdapter.getItemViewType(int)when the item is a header or footer.- See Also:
-
INVALID_POSITION
public static final int INVALID_POSITIONRepresents an invalid position. All valid positions are in the range 0 to 1 less than the number of items in the current adapter.- See Also:
-
INVALID_ROW_ID
public static final long INVALID_ROW_IDRepresents an empty or invalid row id- See Also:
-
-
Constructor Details
-
AdapterView
-
AdapterView
-
AdapterView
public AdapterView(Context context, @Nullable AttributeSet attrs, @Nullable @AttrRes ResourceId defStyleAttr) -
AdapterView
public AdapterView(Context context, @Nullable AttributeSet attrs, @Nullable @AttrRes ResourceId defStyleAttr, @Nullable @StyleRes ResourceId defStyleRes)
-
-
Method Details
-
setOnItemClickListener
Register a callback to be invoked when an item in this AdapterView has been clicked.- Parameters:
listener- The callback that will be invoked.
-
getOnItemClickListener
- Returns:
- The callback to be invoked with an item in this AdapterView has been clicked, or null if no callback has been set.
-
performItemClick
Call the OnItemClickListener, if it is defined. Performs all normal actions associated with clicking: reporting accessibility event, playing a sound, etc.- Parameters:
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.- Returns:
- True if there was an assigned OnItemClickListener that was called, false otherwise is returned.
-
setOnItemLongClickListener
Register a callback to be invoked when an item in this AdapterView has been clicked and held- Parameters:
listener- The callback that will run
-
getOnItemLongClickListener
- Returns:
- The callback to be invoked with an item in this AdapterView has been clicked and held, or null if no callback has been set.
-
setOnItemSelectedListener
Register a callback to be invoked when an item in this AdapterView has been selected.- Parameters:
listener- The callback that will run
-
getOnItemSelectedListener
-
getAdapter
Returns the adapter currently associated with this widget.- Returns:
- The adapter used to provide this view's content.
-
setAdapter
Sets the adapter that provides the data and the views to represent the data in this widget.- Parameters:
adapter- The adapter to use to create this view's content.
-
addView
This method is not supported and throws an UnsupportedOperationException when called.- Overrides:
addViewin classViewGroup- Parameters:
child- Ignored.- Throws:
UnsupportedOperationException- Every time this method is invoked.- See Also:
-
addView
This method is not supported and throws an UnsupportedOperationException when called.- Overrides:
addViewin classViewGroup- Parameters:
child- Ignored.index- Ignored.- Throws:
UnsupportedOperationException- Every time this method is invoked.- See Also:
-
addView
This method is not supported and throws an UnsupportedOperationException when called.- Specified by:
addViewin interfaceViewManager- Overrides:
addViewin classViewGroup- Parameters:
child- Ignored.params- Ignored.- Throws:
UnsupportedOperationException- Every time this method is invoked.
-
addView
This method is not supported and throws an UnsupportedOperationException when called.- Overrides:
addViewin classViewGroup- Parameters:
child- Ignored.index- Ignored.params- Ignored.- Throws:
UnsupportedOperationException- Every time this method is invoked.
-
removeView
This method is not supported and throws an UnsupportedOperationException when called.- Specified by:
removeViewin interfaceViewManager- Overrides:
removeViewin classViewGroup- Parameters:
child- Ignored.- Throws:
UnsupportedOperationException- Every time this method is invoked.
-
removeViewAt
public void removeViewAt(int index) This method is not supported and throws an UnsupportedOperationException when called.- Overrides:
removeViewAtin classViewGroup- Parameters:
index- Ignored.- Throws:
UnsupportedOperationException- Every time this method is invoked.
-
removeAllViews
public void removeAllViews()This method is not supported and throws an UnsupportedOperationException when called.- Overrides:
removeAllViewsin classViewGroup- Throws:
UnsupportedOperationException- Every time this method is invoked.
-
onLayout
protected void onLayout(boolean changed, int left, int top, int right, int bottom) Description copied from class:ViewCalled fromView.layout(int, int, int, int)when this view should assign a size and position to each of its children.Derived classes with children should override this method and call layout on each of their children.
-
getSelectedItemPosition
public int getSelectedItemPosition()Return the position of the currently selected item within the adapter's data set- Returns:
- int Position (starting at 0), or
INVALID_POSITIONif there is nothing selected.
-
getSelectedItemId
public long getSelectedItemId()- Returns:
- The id corresponding to the currently selected item, or
INVALID_ROW_IDif nothing is selected.
-
getSelectedView
- Returns:
- The view corresponding to the currently selected item, or null if nothing is selected
-
getSelectedItem
- Returns:
- The data corresponding to the currently selected item, or null if there is nothing selected.
-
getCount
public int getCount()- 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 views.)
-
getPositionForView
Returns 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.Note: The result of this method only reflects the position of the data bound to view during the most recent layout pass. If the adapter's data set has changed without a subsequent layout pass, the position returned by this method may not match the current position of the data within the adapter.
- Parameters:
view- an adapter item, or a descendant of an adapter item. This must be visible in this AdapterView at the time of the call.- Returns:
- the position within the adapter's data set of the view, or
INVALID_POSITIONif the view does not correspond to a list item (or it is not currently visible)
-
getFirstVisiblePosition
public int getFirstVisiblePosition()Returns the position within the adapter's data set for the first item displayed on screen.- Returns:
- The position within the adapter's data set
-
getLastVisiblePosition
public int getLastVisiblePosition()Returns the position within the adapter's data set for the last item displayed on screen.- Returns:
- The position within the adapter's data set
-
setSelection
public abstract void setSelection(int position) Sets the currently selected item. To support accessibility subclasses that override this method must invoke the overridden super method first.- Parameters:
position- Index (starting at 0) of the data item to be selected.
-
setEmptyView
Sets the view to show if the adapter is empty -
getEmptyView
When the current adapter is empty, the AdapterView can display a special view called the empty view. The empty view is used to provide feedback to the user that no data is available in this AdapterView.- Returns:
- The view to show if the adapter is empty.
-
setFocusable
public void setFocusable(int focusable) Description copied from class:ViewSets whether this view can receive focus.Setting this to
View.FOCUSABLE_AUTOtells the framework to determine focusability automatically based on the view's interactivity. This is the default.Setting this to NOT_FOCUSABLE will ensure that this view is also not focusable in touch mode.
- Overrides:
setFocusablein classView- Parameters:
focusable- One ofView.NOT_FOCUSABLE,View.FOCUSABLE, orView.FOCUSABLE_AUTO.- See Also:
-
setFocusableInTouchMode
public void setFocusableInTouchMode(boolean focusable) Description copied from class:ViewSet whether this view can receive focus while in touch mode.Setting this to true will also ensure that this view is focusable.
- Overrides:
setFocusableInTouchModein classView- Parameters:
focusable- If true, this view can receive the focus while in touch mode.- See Also:
-
getItemAtPosition
Gets the data associated with the specified position in the list.- Parameters:
position- Which data to get- Returns:
- The data associated with the specified position in the list
-
getItemIdAtPosition
public long getItemIdAtPosition(int position) -
setOnClickListener
Description copied from class:ViewRegister a callback to be invoked when this view is clicked. If this view is not clickable, it becomes clickable.- Overrides:
setOnClickListenerin classView- Parameters:
l- The callback that will run- See Also:
-
onDetachedFromWindow
protected void onDetachedFromWindow()Description copied from class:ViewThis is called when the view is detached from a window. At this point it no longer has a surface for drawing.- Overrides:
onDetachedFromWindowin classView- See Also:
-