public class ListView extends AbsListView
ListAdapter
associated with this view.
See the List View guide.
Modifier and Type | Class and Description |
---|---|
class |
ListView.FixedViewInfo
A class that represents a fixed view in a list, for example a header at the top
or a footer at the bottom.
|
AbsListView.LayoutParams, AbsListView.MultiChoiceModeListener, AbsListView.OnScrollListener, AbsListView.RecyclerListener, AbsListView.SelectionBoundsAdjuster
AdapterView.AdapterContextMenuInfo, AdapterView.OnItemClickListener, AdapterView.OnItemLongClickListener, AdapterView.OnItemSelectedListener
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
NoCopySpan.Concrete
CHOICE_MODE_MULTIPLE, CHOICE_MODE_MULTIPLE_MODAL, CHOICE_MODE_NONE, CHOICE_MODE_SINGLE, TRANSCRIPT_MODE_ALWAYS_SCROLL, TRANSCRIPT_MODE_DISABLED, TRANSCRIPT_MODE_NORMAL
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 |
---|
ListView(Context context) |
ListView(Context context,
AttributeSet attrs) |
ListView(Context context,
AttributeSet attrs,
int defStyle) |
Modifier and Type | Method and Description |
---|---|
void |
addFooterView(View v)
Add a fixed view to appear at the bottom of the list.
|
void |
addFooterView(View v,
Object data,
boolean isSelectable)
Add a fixed view to appear at the bottom of the list.
|
void |
addHeaderView(View v)
Add a fixed view to appear at the top of the list.
|
void |
addHeaderView(View v,
Object data,
boolean isSelectable)
Add a fixed view to appear at the top of the list.
|
protected boolean |
canAnimate()
Indicates whether the view group has the ability to animate its children
after the first layout.
|
protected void |
dispatchDraw(Canvas canvas)
Called by draw to draw the child views.
|
boolean |
dispatchKeyEvent(KeyEvent event)
Dispatch a key event to the next view on the focus path.
|
protected boolean |
drawChild(Canvas canvas,
View child,
long drawingTime)
Draw one child of this View Group.
|
protected View |
findViewByPredicateTraversal(com.android.internal.util.Predicate<View> predicate,
View childToSkip) |
protected View |
findViewTraversal(int id) |
protected View |
findViewWithTagTraversal(Object tag) |
ListAdapter |
getAdapter()
Returns the adapter currently in use in this ListView.
|
long[] |
getCheckItemIds()
Deprecated.
Use
AbsListView.getCheckedItemIds() instead. |
Drawable |
getDivider()
Returns the drawable that will be drawn between each item in the list.
|
int |
getDividerHeight() |
int |
getFooterViewsCount()
Returns the number of footer views in the list.
|
int |
getHeaderViewsCount()
Returns the number of header views in the list.
|
boolean |
getItemsCanFocus() |
int |
getMaxScrollAmount() |
Drawable |
getOverscrollFooter() |
Drawable |
getOverscrollHeader() |
boolean |
isOpaque()
Indicates whether this View is opaque.
|
protected void |
layoutChildren()
Subclasses must override this method to layout their children.
|
protected void |
onFinishInflate()
Finalize inflating a view from XML.
|
protected void |
onFocusChanged(boolean gainFocus,
int direction,
Rect previouslyFocusedRect)
Called by the view system when the focus state of this view changes.
|
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. |
boolean |
onKeyDown(int keyCode,
KeyEvent event)
Default implementation of
KeyEvent.Callback.onKeyDown() : perform press of the view
when KeyEvent.KEYCODE_DPAD_CENTER or KeyEvent.KEYCODE_ENTER
is released, if the view is enabled and clickable. |
boolean |
onKeyMultiple(int keyCode,
int repeatCount,
KeyEvent event)
Default implementation of
KeyEvent.Callback.onKeyMultiple() : always returns false (doesn't handle
the event). |
boolean |
onKeyUp(int keyCode,
KeyEvent event)
Default implementation of
KeyEvent.Callback.onKeyUp() : perform clicking of the view
when KeyEvent.KEYCODE_DPAD_CENTER or
KeyEvent.KEYCODE_ENTER is released. |
protected void |
onMeasure(int widthMeasureSpec,
int heightMeasureSpec)
Measure the view and its content to determine the measured width and the
measured height.
|
protected void |
onSizeChanged(int w,
int h,
int oldw,
int oldh)
This is called during layout when the size of this view has changed.
|
protected boolean |
recycleOnMeasure() |
boolean |
removeFooterView(View v)
Removes a previously-added footer view.
|
boolean |
removeHeaderView(View v)
Removes a previously-added header view.
|
boolean |
requestChildRectangleOnScreen(View child,
Rect rect,
boolean immediate)
Called when a child of this group wants a particular rectangle to be
positioned onto the screen.
|
void |
setAdapter(ListAdapter adapter)
Sets the data behind this ListView.
|
void |
setCacheColorHint(int color)
When set to a non-zero value, the cache color hint indicates that this list is always drawn
on top of a solid, single-color, opaque background.
|
void |
setDivider(Drawable divider)
Sets the drawable that will be drawn between each item in the list.
|
void |
setDividerHeight(int height)
Sets the height of the divider that will be drawn between each item in the list.
|
void |
setFooterDividersEnabled(boolean footerDividersEnabled)
Enables or disables the drawing of the divider for footer views.
|
void |
setHeaderDividersEnabled(boolean headerDividersEnabled)
Enables or disables the drawing of the divider for header views.
|
void |
setItemsCanFocus(boolean itemsCanFocus)
Indicates that the views created by the ListAdapter can contain focusable
items.
|
void |
setOverscrollFooter(Drawable footer)
Sets the drawable that will be drawn below all other list content.
|
void |
setOverscrollHeader(Drawable header)
Sets the drawable that will be drawn above all other list content.
|
void |
setRemoteViewsAdapter(Intent intent)
Sets up this AbsListView to use a remote views adapter which connects to a RemoteViewsService
through the specified intent.
|
void |
setSelection(int position)
Sets the currently selected item.
|
void |
setSelectionAfterHeaderView()
setSelectionAfterHeaderView set the selection to be the first list item
after the header views.
|
void |
setSelectionFromTop(int position,
int y)
Sets the selected item and positions the selection y pixels from the top edge
of the ListView.
|
void |
smoothScrollByOffset(int offset)
Smoothly scroll to the specified adapter position offset.
|
void |
smoothScrollToPosition(int position)
Smoothly scroll to the specified adapter position.
|
addTouchables, afterTextChanged, beforeTextChanged, checkInputConnectionProxy, checkLayoutParams, clearChoices, clearTextFilter, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, deferNotifyDataSetChanged, dispatchSetPressed, draw, drawableStateChanged, generateDefaultLayoutParams, generateLayoutParams, generateLayoutParams, getBottomFadingEdgeStrength, getBottomPaddingOffset, getCacheColorHint, getCheckedItemCount, getCheckedItemIds, getCheckedItemPosition, getCheckedItemPositions, getChoiceMode, getContextMenuInfo, getFocusedRect, getLeftPaddingOffset, getListPaddingBottom, getListPaddingLeft, getListPaddingRight, getListPaddingTop, getRightPaddingOffset, getSelectedView, getSelector, getSolidColor, getTextFilter, getTopFadingEdgeStrength, getTopPaddingOffset, getTranscriptMode, getVerticalScrollbarWidth, handleDataChanged, hasTextFilter, invalidateViews, isFastScrollAlwaysVisible, isFastScrollEnabled, isInFilterMode, isItemChecked, isPaddingOffsetRequired, isScrollingCacheEnabled, isSmoothScrollbarEnabled, isStackFromBottom, isTextFilterEnabled, isVerticalScrollBarHidden, jumpDrawablesToCurrentState, onAttachedToWindow, onCreateDrawableState, onCreateInputConnection, onDetachedFromWindow, onDisplayHint, onFilterComplete, onGenericMotionEvent, onGlobalLayout, onInterceptTouchEvent, onLayout, onOverScrolled, onRemoteAdapterConnected, onRemoteAdapterDisconnected, onRestoreInstanceState, onSaveInstanceState, onTextChanged, onTouchEvent, onTouchModeChanged, onWindowFocusChanged, performAccessibilityAction, performItemClick, pointToPosition, pointToRowId, reclaimViews, requestDisallowInterceptTouchEvent, requestLayout, sendAccessibilityEvent, setChoiceMode, setDrawSelectorOnTop, setFastScrollAlwaysVisible, setFastScrollEnabled, setFilterText, setFrame, setFriction, setItemChecked, setMultiChoiceModeListener, setOnScrollListener, setOverScrollEffectPadding, setOverScrollMode, setRecyclerListener, setRemoteViewsOnClickHandler, setScrollIndicators, setScrollingCacheEnabled, setSelector, setSelector, setSmoothScrollbarEnabled, setStackFromBottom, setTextFilterEnabled, setTranscriptMode, setVelocityScale, setVerticalScrollbarPosition, showContextMenu, showContextMenuForChild, smoothScrollBy, smoothScrollToPosition, smoothScrollToPositionFromTop, smoothScrollToPositionFromTop, verifyDrawable
addView, addView, addView, addView, dispatchPopulateAccessibilityEvent, dispatchRestoreInstanceState, dispatchSaveInstanceState, getCount, getEmptyView, getFirstVisiblePosition, getItemAtPosition, getItemIdAtPosition, getLastVisiblePosition, getOnItemClickListener, getOnItemLongClickListener, getOnItemSelectedListener, getPositionForView, getSelectedItem, getSelectedItemId, getSelectedItemPosition, onRequestSendAccessibilityEvent, removeAllViews, removeView, removeViewAt, setEmptyView, setFocusable, setFocusableInTouchMode, setOnClickListener, setOnItemClickListener, setOnItemLongClickListener, setOnItemSelectedListener
addChildrenForAccessibility, addFocusables, addStatesFromChildren, addView, addViewInLayout, addViewInLayout, attachLayoutAnimationParameters, attachViewToParent, bringChildToFront, childAccessibilityStateChanged, childDrawableStateChanged, childHasTransientStateChanged, cleanupLayoutState, clearChildFocus, clearDisappearingChildren, clearFocus, debug, detachAllViewsFromParent, detachViewFromParent, detachViewFromParent, detachViewsFromParent, dispatchConfigurationChanged, dispatchDisplayHint, dispatchDragEvent, dispatchFinishTemporaryDetach, dispatchFreezeSelfOnly, dispatchGenericFocusedEvent, dispatchGenericPointerEvent, dispatchGetDisplayList, dispatchHoverEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchSetActivated, dispatchSetSelected, dispatchStartTemporaryDetach, dispatchSystemUiVisibilityChanged, dispatchThawSelfOnly, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchVisibilityChanged, dispatchWindowFocusChanged, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, endViewTransition, findFocus, findViewsWithText, fitSystemWindows, focusableViewAvailable, focusSearch, gatherTransparentRegion, 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, layout, makeOptionalFitsSystemWindows, measureChild, measureChildren, measureChildWithMargins, offsetChildrenTopAndBottom, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onAnimationEnd, onAnimationStart, onChildVisibilityChanged, onDebugDraw, onDebugDrawMargins, onInterceptHoverEvent, onRequestFocusInDescendants, onSetLayoutParams, onViewAdded, onViewRemoved, recomputeViewAttributes, removeAllViewsInLayout, removeDetachedView, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, 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, startActionModeForChild, startLayoutAnimation, startViewTransition, updateViewLayout
addFocusables, addOnAttachStateChangeListener, addOnLayoutChangeListener, animate, announceForAccessibility, applyDrawableToTransparentRegion, awakenScrollBars, awakenScrollBars, awakenScrollBars, bringToFront, buildDrawingCache, buildDrawingCache, buildLayer, callOnClick, cancelLongPress, canHaveDisplayList, canResolveLayoutDirection, canScrollHorizontally, canScrollVertically, clearAccessibilityFocus, clearAnimation, combineMeasuredStates, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeOpaqueFlags, computeScroll, createAccessibilityNodeInfo, createContextMenu, debug, debugIndent, destroyDrawingCache, destroyHardwareResources, dispatchGenericMotionEvent, dispatchPointerEvent, findViewById, findViewByPredicate, findViewByPredicateInsideOut, findViewWithTag, fitsSystemWindows, focusSearch, forceLayout, generateViewId, getAccessibilityCursorPosition, getAccessibilityDelegate, getAccessibilityNodeProvider, getAccessibilityViewId, getAccessibilityWindowId, getAlpha, getAnimation, getApplicationWindowToken, getBackground, getBaseline, getBottom, getCameraDistance, getContentDescription, getContext, getDefaultSize, getDisplay, getDisplayList, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getFadeHeight, getFadeTop, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusables, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHardwareRenderer, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getHorizontalScrollFactor, getId, getImportantForAccessibility, getIterableTextForAccessibility, getIteratorForGranularity, getKeepScreenOn, getKeyDispatcherState, getLabelFor, getLayerType, getLayoutDirection, getLayoutParams, getLeft, getLeftFadingEdgeStrength, 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, getRootView, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollX, getScrollY, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getSystemUiVisibility, getTag, getTag, getTextAlignment, getTextDirection, getTop, getTouchables, getTouchDelegate, getTranslationX, getTranslationY, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, 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, isPaddingRelative, isPressed, isRootNamespace, isSaveEnabled, isSaveFromParentEnabled, isScrollbarFadingEnabled, isScrollContainer, isSelected, isShown, isSoundEffectsEnabled, isTextAlignmentInherited, isTextDirectionInherited, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, isVisibleToUser, isVisibleToUser, measure, mergeDrawableStates, notifyAccessibilityStateChanged, offsetLeftAndRight, offsetTopAndBottom, onCheckIsTextEditor, onCloseSystemDialogs, onConfigurationChanged, onCreateContextMenu, onDragEvent, onDraw, onDrawHorizontalScrollBar, onDrawScrollBars, onDrawVerticalScrollBar, onFilterTouchEventForSecurity, onFinishTemporaryDetach, onFocusLost, onHoverChanged, onHoverEvent, onKeyLongPress, onKeyPreIme, onKeyShortcut, onPopulateAccessibilityEvent, onResolveDrawables, onRtlPropertiesChanged, onScreenStateChanged, onScrollChanged, onSetAlpha, onStartTemporaryDetach, onTrackballEvent, onVisibilityChanged, onWindowSystemUiVisibilityChanged, onWindowVisibilityChanged, outputDirtyFlags, overScrollBy, performButtonActionOnTouchDown, performClick, 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, sendAccessibilityEventUnchecked, setAccessibilityCursorPosition, setAccessibilityDelegate, setActivated, setAlpha, setAnimation, setBackground, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setBottom, setCameraDistance, setClickable, setContentDescription, setDisabledSystemUiVisibility, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, 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, 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, setVisibility, setWillNotCacheDrawing, setWillNotDraw, setX, setY, showContextMenu, startActionMode, startAnimation, startDrag, toString, unscheduleDrawable, unscheduleDrawable, willNotCacheDrawing, willNotDraw
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
createContextMenu, getParent, getParentForAccessibility, isLayoutRequested, requestFitSystemWindows
public ListView(Context context)
public ListView(Context context, AttributeSet attrs)
public ListView(Context context, AttributeSet attrs, int defStyle)
public int getMaxScrollAmount()
public void addHeaderView(View v, Object data, boolean isSelectable)
NOTE: Call this before calling setAdapter. This is so ListView can wrap the supplied cursor with one that will also account for header and footer views.
v
- The view to add.data
- Data to associate with this viewisSelectable
- whether the item is selectablepublic void addHeaderView(View v)
NOTE: Call this before calling setAdapter. This is so ListView can wrap the supplied cursor with one that will also account for header and footer views.
v
- The view to add.public int getHeaderViewsCount()
AbsListView
public boolean removeHeaderView(View v)
v
- The view to removepublic void addFooterView(View v, Object data, boolean isSelectable)
NOTE: Call this before calling setAdapter. This is so ListView can wrap the supplied cursor with one that will also account for header and footer views.
v
- The view to add.data
- Data to associate with this viewisSelectable
- true if the footer view can be selectedpublic void addFooterView(View v)
NOTE: Call this before calling setAdapter. This is so ListView can wrap the supplied cursor with one that will also account for header and footer views.
v
- The view to add.public int getFooterViewsCount()
AbsListView
public boolean removeFooterView(View v)
v
- The view to removepublic ListAdapter getAdapter()
setAdapter(ListAdapter)
but
might be a WrapperListAdapter
.getAdapter
in class AdapterView<ListAdapter>
setAdapter(ListAdapter)
public void setRemoteViewsAdapter(Intent intent)
setRemoteViewsAdapter
in class AbsListView
intent
- the intent used to identify the RemoteViewsService for the adapter to connect to.public void setAdapter(ListAdapter adapter)
WrapperListAdapter
,
depending on the ListView features currently in use. For instance, adding
headers and/or footers will cause the adapter to be wrapped.setAdapter
in class AbsListView
adapter
- The ListAdapter which is responsible for maintaining the
data backing this list and for producing a view to represent an
item in that data set.getAdapter()
public boolean requestChildRectangleOnScreen(View child, Rect rect, boolean immediate)
ViewGroup
ViewGroup
s overriding this can trust
that:
ViewGroup
s overriding this should uphold the contract:
requestChildRectangleOnScreen
in interface ViewParent
requestChildRectangleOnScreen
in class ViewGroup
child
- The direct child making the request.rect
- The rectangle in the child's coordinates the child
wishes to be on the screen.immediate
- True to forbid animated or delayed scrolling,
false otherwisepublic void smoothScrollToPosition(int position)
smoothScrollToPosition
in class AbsListView
position
- Scroll to this adapter position.public void smoothScrollByOffset(int offset)
offset
- The amount to offset from the adapter position to scroll to.protected void onSizeChanged(int w, int h, int oldw, int oldh)
View
onSizeChanged
in class AbsListView
w
- Current width of this view.h
- Current height of this view.oldw
- Old width of this view.oldh
- Old height of this view.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 AbsListView
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
.View.getMeasuredWidth()
,
View.getMeasuredHeight()
,
View.setMeasuredDimension(int, int)
,
View.getSuggestedMinimumHeight()
,
View.getSuggestedMinimumWidth()
,
View.MeasureSpec.getMode(int)
,
View.MeasureSpec.getSize(int)
protected boolean recycleOnMeasure()
protected void layoutChildren()
AbsListView
layoutChildren
in class AbsListView
protected boolean canAnimate()
ViewGroup
canAnimate
in class AdapterView<ListAdapter>
public void setSelection(int position)
setSelection
in class AdapterView<ListAdapter>
position
- Index (starting at 0) of the data item to be selected.public void setSelectionFromTop(int position, int y)
position
- Index (starting at 0) of the data item to be selected.y
- The distance from the top edge of the ListView (plus padding) that the
item will be positioned.public void setSelectionAfterHeaderView()
public boolean dispatchKeyEvent(KeyEvent event)
ViewGroup
dispatchKeyEvent
in class ViewGroup
event
- The key event to be dispatched.public boolean onKeyDown(int keyCode, KeyEvent event)
View
KeyEvent.Callback.onKeyDown()
: perform press of the view
when KeyEvent.KEYCODE_DPAD_CENTER
or KeyEvent.KEYCODE_ENTER
is released, if the view is enabled and clickable.
Key presses in software keyboards will generally NOT trigger this listener, although some may elect to do so in some situations. Do not rely on this to catch software key presses.
onKeyDown
in interface KeyEvent.Callback
onKeyDown
in class AbsListView
keyCode
- A key code that represents the button pressed, from
KeyEvent
.event
- The KeyEvent object that defines the button action.public boolean onKeyMultiple(int keyCode, int repeatCount, KeyEvent event)
View
KeyEvent.Callback.onKeyMultiple()
: always returns false (doesn't handle
the event).
Key presses in software keyboards will generally NOT trigger this listener, although some may elect to do so in some situations. Do not rely on this to catch software key presses.
onKeyMultiple
in interface KeyEvent.Callback
onKeyMultiple
in class View
keyCode
- A key code that represents the button pressed, from
KeyEvent
.repeatCount
- The number of times the action was made.event
- The KeyEvent object that defines the button action.public boolean onKeyUp(int keyCode, KeyEvent event)
View
KeyEvent.Callback.onKeyUp()
: perform clicking of the view
when KeyEvent.KEYCODE_DPAD_CENTER
or
KeyEvent.KEYCODE_ENTER
is released.
Key presses in software keyboards will generally NOT trigger this listener, although some may elect to do so in some situations. Do not rely on this to catch software key presses.
onKeyUp
in interface KeyEvent.Callback
onKeyUp
in class AbsListView
keyCode
- A key code that represents the button pressed, from
KeyEvent
.event
- The KeyEvent object that defines the button action.public void setItemsCanFocus(boolean itemsCanFocus)
itemsCanFocus
- true if items can get focus, false otherwisepublic boolean getItemsCanFocus()
public boolean isOpaque()
View
public void setCacheColorHint(int color)
AbsListView
View.setBackgroundDrawable(Drawable)
).setCacheColorHint
in class AbsListView
color
- The background colorprotected void dispatchDraw(Canvas canvas)
ViewGroup
dispatchDraw
in class AbsListView
canvas
- the canvas on which to draw the viewprotected boolean drawChild(Canvas canvas, View child, long drawingTime)
ViewGroup
public Drawable getDivider()
public void setDivider(Drawable divider)
setDividerHeight(int)
divider
- The drawable to use.public int getDividerHeight()
public void setDividerHeight(int height)
setDivider(Drawable)
height
- The new height of the divider in pixels.public void setHeaderDividersEnabled(boolean headerDividersEnabled)
headerDividersEnabled
- True to draw the headers, false otherwise.setFooterDividersEnabled(boolean)
,
addHeaderView(android.view.View)
public void setFooterDividersEnabled(boolean footerDividersEnabled)
footerDividersEnabled
- True to draw the footers, false otherwise.setHeaderDividersEnabled(boolean)
,
addFooterView(android.view.View)
public void setOverscrollHeader(Drawable header)
header
- The drawable to usepublic Drawable getOverscrollHeader()
public void setOverscrollFooter(Drawable footer)
footer
- The drawable to usepublic Drawable getOverscrollFooter()
protected void onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect)
View
onFocusChanged
in class AbsListView
gainFocus
- True if the View has focus; false otherwise.direction
- The direction focus has moved when requestFocus()
is called to give this view focus. Values are
View.FOCUS_UP
, View.FOCUS_DOWN
, View.FOCUS_LEFT
,
View.FOCUS_RIGHT
, View.FOCUS_FORWARD
, or View.FOCUS_BACKWARD
.
It may not always apply, in which case use the default.previouslyFocusedRect
- The rectangle, in this view's coordinate
system, of the previously focused view. If applicable, this will be
passed in as finer grained information about where the focus is coming
from (in addition to direction). Will be null
otherwise.protected void onFinishInflate()
View
Even if the subclass overrides onFinishInflate, they should always be sure to call the super method, so that we get called.
onFinishInflate
in class View
protected View findViewTraversal(int id)
ViewGroup
findViewTraversal
in class ViewGroup
id
- the id of the view to be foundprotected View findViewWithTagTraversal(Object tag)
ViewGroup
findViewWithTagTraversal
in class ViewGroup
tag
- the tag of the view to be foundprotected View findViewByPredicateTraversal(com.android.internal.util.Predicate<View> predicate, View childToSkip)
ViewGroup
findViewByPredicateTraversal
in class ViewGroup
predicate
- The predicate to evaluate.childToSkip
- If not null, ignores this child during the recursive traversal.First look in our children, then in any header and footer views that may be scrolled off.
@Deprecated public long[] getCheckItemIds()
AbsListView.getCheckedItemIds()
instead.AbsListView.CHOICE_MODE_NONE
.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 AbsListView
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 AbsListView
info
- The instance to initialize.