android.widget
Class ListView

java.lang.Object
  extended by android.view.View
      extended by android.view.ViewGroup
          extended by android.widget.AdapterView<ListAdapter>
              extended by android.widget.AbsListView
                  extended by android.widget.ListView
All Implemented Interfaces:
Drawable.Callback, NoCopySpan, TextWatcher, AccessibilityEventSource, KeyEvent.Callback, ViewManager, ViewParent, ViewTreeObserver.OnGlobalLayoutListener, ViewTreeObserver.OnTouchModeChangeListener, Filter.FilterListener
Direct Known Subclasses:
ExpandableListView

public class ListView
extends AbsListView


Nested Class Summary
 class ListView.FixedViewInfo
           
 
Nested classes/interfaces inherited from class android.widget.AbsListView
AbsListView.LayoutParams, AbsListView.OnScrollListener, AbsListView.RecyclerListener
 
Nested classes/interfaces inherited from class android.widget.AdapterView
AdapterView.AdapterContextMenuInfo, AdapterView.OnItemClickListener, AdapterView.OnItemLongClickListener, AdapterView.OnItemSelectedListener
 
Nested classes/interfaces inherited from class android.view.ViewGroup
ViewGroup.MarginLayoutParams, ViewGroup.OnHierarchyChangeListener
 
Nested classes/interfaces inherited from class android.view.View
View.BaseSavedState, View.MeasureSpec, View.OnClickListener, View.OnCreateContextMenuListener, View.OnFocusChangeListener, View.OnKeyListener, View.OnLongClickListener, View.OnTouchListener
 
Nested classes/interfaces inherited from interface android.text.NoCopySpan
NoCopySpan.Concrete
 
Field Summary
static int CHOICE_MODE_MULTIPLE
           
static int CHOICE_MODE_NONE
           
static int CHOICE_MODE_SINGLE
           
 
Fields inherited from class android.widget.AbsListView
TRANSCRIPT_MODE_ALWAYS_SCROLL, TRANSCRIPT_MODE_DISABLED, TRANSCRIPT_MODE_NORMAL
 
Fields inherited from class android.widget.AdapterView
INVALID_POSITION, INVALID_ROW_ID, ITEM_VIEW_TYPE_HEADER_OR_FOOTER, ITEM_VIEW_TYPE_IGNORE
 
Fields inherited from class android.view.ViewGroup
CLIP_TO_PADDING_MASK, FOCUS_AFTER_DESCENDANTS, FOCUS_BEFORE_DESCENDANTS, FOCUS_BLOCK_DESCENDANTS, PERSISTENT_ALL_CACHES, PERSISTENT_ANIMATION_CACHE, PERSISTENT_NO_CACHE, PERSISTENT_SCROLLING_CACHE
 
Fields inherited from class android.view.View
DRAWING_CACHE_QUALITY_AUTO, DRAWING_CACHE_QUALITY_HIGH, DRAWING_CACHE_QUALITY_LOW, EMPTY_STATE_SET, ENABLED_FOCUSED_SELECTED_STATE_SET, ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_FOCUSED_STATE_SET, ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, ENABLED_SELECTED_STATE_SET, ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_STATE_SET, ENABLED_WINDOW_FOCUSED_STATE_SET, 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, INVISIBLE, KEEP_SCREEN_ON, NO_ID, PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET, PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_SELECTED_STATE_SET, PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_STATE_SET, PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET, PRESSED_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_WINDOW_FOCUSED_STATE_SET, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SELECTED_STATE_SET, SELECTED_WINDOW_FOCUSED_STATE_SET, SOUND_EFFECTS_ENABLED, VIEW_LOG_TAG, VISIBLE, WINDOW_FOCUSED_STATE_SET
 
Constructor Summary
ListView(Context context)
           
ListView(Context context, AttributeSet attrs)
           
ListView(Context context, AttributeSet attrs, int defStyle)
           
 
Method Summary
 void addFooterView(View v)
           
 void addFooterView(View v, java.lang.Object data, boolean isSelectable)
           
 void addHeaderView(View v)
           
 void addHeaderView(View v, java.lang.Object data, boolean isSelectable)
           
protected  boolean canAnimate()
           
 void clearChoices()
           
protected  void dispatchDraw(Canvas canvas)
           
 boolean dispatchKeyEvent(KeyEvent event)
           
 boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event)
           
protected  View findViewTraversal(int id)
           
protected  View findViewWithTagTraversal(java.lang.Object tag)
           
 ListAdapter getAdapter()
           
 int getCheckedItemPosition()
           
 SparseBooleanArray getCheckedItemPositions()
           
 long[] getCheckItemIds()
           
 int getChoiceMode()
           
 Drawable getDivider()
           
 int getDividerHeight()
           
 int getFooterViewsCount()
           
 int getHeaderViewsCount()
           
 boolean getItemsCanFocus()
           
 int getMaxScrollAmount()
           
 boolean isItemChecked(int position)
           
protected  void layoutChildren()
           
protected  void onFinishInflate()
           
protected  void onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect)
           
 boolean onKeyDown(int keyCode, KeyEvent event)
           
 boolean onKeyMultiple(int keyCode, int repeatCount, KeyEvent event)
           
 boolean onKeyUp(int keyCode, KeyEvent event)
           
protected  void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
           
 void onRestoreInstanceState(Parcelable state)
           
 Parcelable onSaveInstanceState()
           
 boolean onTouchEvent(MotionEvent ev)
           
 boolean performItemClick(View view, int position, long id)
           
 boolean removeFooterView(View v)
           
 boolean removeHeaderView(View v)
           
 boolean requestChildRectangleOnScreen(View child, Rect rect, boolean immediate)
           
 void setAdapter(ListAdapter adapter)
           
 void setCacheColorHint(int color)
           
 void setChoiceMode(int choiceMode)
           
 void setDivider(Drawable divider)
           
 void setDividerHeight(int height)
           
 void setFooterDividersEnabled(boolean footerDividersEnabled)
           
 void setHeaderDividersEnabled(boolean headerDividersEnabled)
           
 void setItemChecked(int position, boolean value)
           
 void setItemsCanFocus(boolean itemsCanFocus)
           
 void setSelection(int position)
           
 void setSelectionAfterHeaderView()
           
 void setSelectionFromTop(int position, int y)
           
 
Methods inherited from class android.widget.AbsListView
addTouchables, afterTextChanged, beforeTextChanged, checkInputConnectionProxy, checkLayoutParams, clearTextFilter, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, dispatchSetPressed, draw, drawableStateChanged, generateLayoutParams, generateLayoutParams, getBottomFadingEdgeStrength, getCacheColorHint, getContextMenuInfo, getFocusedRect, getListPaddingBottom, getListPaddingLeft, getListPaddingRight, getListPaddingTop, getSelectedView, getSelector, getSolidColor, getTextFilter, getTopFadingEdgeStrength, getTranscriptMode, handleDataChanged, hasTextFilter, invalidateViews, isFastScrollEnabled, isInFilterMode, isScrollingCacheEnabled, isSmoothScrollbarEnabled, isStackFromBottom, isTextFilterEnabled, onAttachedToWindow, onCreateDrawableState, onCreateInputConnection, onDetachedFromWindow, onFilterComplete, onGlobalLayout, onInterceptTouchEvent, onLayout, onSizeChanged, onTextChanged, onTouchModeChanged, onWindowFocusChanged, pointToPosition, pointToRowId, reclaimViews, requestLayout, setDrawSelectorOnTop, setFastScrollEnabled, setFilterText, setOnScrollListener, setRecyclerListener, setScrollIndicators, setScrollingCacheEnabled, setSelector, setSelector, setSmoothScrollbarEnabled, setStackFromBottom, setTextFilterEnabled, setTranscriptMode, showContextMenuForChild, verifyDrawable
 
Methods inherited from class android.widget.AdapterView
addView, addView, addView, addView, dispatchRestoreInstanceState, dispatchSaveInstanceState, getCount, getEmptyView, getFirstVisiblePosition, getItemAtPosition, getItemIdAtPosition, getLastVisiblePosition, getOnItemClickListener, getOnItemLongClickListener, getOnItemSelectedListener, getPositionForView, getSelectedItem, getSelectedItemId, getSelectedItemPosition, removeAllViews, removeView, removeViewAt, setEmptyView, setFocusable, setFocusableInTouchMode, setOnClickListener, setOnItemClickListener, setOnItemLongClickListener, setOnItemSelectedListener
 
Methods inherited from class android.view.ViewGroup
addFocusables, addFocusables, addStatesFromChildren, addView, addViewInLayout, addViewInLayout, attachLayoutAnimationParameters, attachViewToParent, bringChildToFront, childDrawableStateChanged, cleanupLayoutState, clearChildFocus, clearDisappearingChildren, clearFocus, debug, detachAllViewsFromParent, detachViewFromParent, detachViewFromParent, detachViewsFromParent, dispatchFreezeSelfOnly, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchSetSelected, dispatchThawSelfOnly, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchWindowFocusChanged, dispatchWindowVisibilityChanged, drawChild, findFocus, fitSystemWindows, focusableViewAvailable, focusSearch, gatherTransparentRegion, generateDefaultLayoutParams, getChildAt, getChildCount, getChildDrawingOrder, getChildMeasureSpec, getChildStaticTransformation, getChildVisibleRect, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getPersistentDrawingCache, hasFocus, hasFocusable, indexOfChild, invalidateChild, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isChildrenDrawingOrderEnabled, isChildrenDrawnWithCacheEnabled, measureChild, measureChildren, measureChildWithMargins, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onAnimationEnd, onAnimationStart, onRequestFocusInDescendants, recomputeViewAttributes, removeAllViewsInLayout, removeDetachedView, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestDisallowInterceptTouchEvent, requestFocus, requestTransparentRegion, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setChildrenDrawingCacheEnabled, setChildrenDrawingOrderEnabled, setChildrenDrawnWithCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setOnHierarchyChangeListener, setPadding, setPersistentDrawingCache, setStaticTransformationsEnabled, startLayoutAnimation, updateViewLayout
 
Methods inherited from class android.view.View
awakenScrollBars, awakenScrollBars, awakenScrollBars, bringToFront, buildDrawingCache, buildDrawingCache, cancelLongPress, clearAnimation, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeScroll, createContextMenu, destroyDrawingCache, finalize, findViewById, findViewWithTag, focusSearch, forceLayout, getAnimation, getApplicationWindowToken, getBackground, getBaseline, getBottom, getBottomPaddingOffset, getContentDescription, getContext, getDefaultSize, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getFocusables, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getId, getKeepScreenOn, getKeyDispatcherState, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLeftPaddingOffset, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMeasuredHeight, getMeasuredWidth, getNextFocusDownId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getParent, getResources, getRight, getRightFadingEdgeStrength, getRightPaddingOffset, getRootView, getScrollBarStyle, getScrollX, getScrollY, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getTag, getTag, getTop, getTopPaddingOffset, getTouchables, getTouchDelegate, getVerticalFadingEdgeLength, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, hasWindowFocus, inflate, initializeFadingEdge, initializeScrollbars, invalidate, invalidate, invalidate, invalidateDrawable, isClickable, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isHapticFeedbackEnabled, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isInEditMode, isInTouchMode, isLayoutRequested, isLongClickable, isOpaque, isPaddingOffsetRequired, isPressed, isSaveEnabled, isScrollbarFadingEnabled, isSelected, isShown, isSoundEffectsEnabled, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, layout, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onCheckIsTextEditor, onCreateContextMenu, onDraw, onDrawScrollBars, onFinishTemporaryDetach, onKeyLongPress, onKeyPreIme, onKeyShortcut, onScrollChanged, onSetAlpha, onStartTemporaryDetach, onTrackballEvent, onWindowVisibilityChanged, performClick, performHapticFeedback, performHapticFeedback, performLongClick, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, refreshDrawableState, removeCallbacks, requestFocus, requestFocus, requestFocusFromTouch, requestRectangleOnScreen, requestRectangleOnScreen, resolveSize, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAnimation, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setClickable, setContentDescription, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setEnabled, setFadingEdgeLength, setHapticFeedbackEnabled, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setId, setKeepScreenOn, setLayoutParams, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNextFocusDownId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnCreateContextMenuListener, setOnFocusChangeListener, setOnKeyListener, setOnLongClickListener, setOnTouchListener, setPressed, setSaveEnabled, setScrollbarFadingEnabled, setScrollBarStyle, setScrollContainer, setSelected, setSoundEffectsEnabled, setTag, setTag, setTouchDelegate, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVisibility, setWillNotCacheDrawing, setWillNotDraw, showContextMenu, startAnimation, unscheduleDrawable, unscheduleDrawable, willNotCacheDrawing, willNotDraw
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface android.view.ViewParent
createContextMenu, getParent, isLayoutRequested
 

Field Detail

CHOICE_MODE_NONE

public static final int CHOICE_MODE_NONE
See Also:
Constant Field Values

CHOICE_MODE_SINGLE

public static final int CHOICE_MODE_SINGLE
See Also:
Constant Field Values

CHOICE_MODE_MULTIPLE

public static final int CHOICE_MODE_MULTIPLE
See Also:
Constant Field Values
Constructor Detail

ListView

public ListView(Context context)

ListView

public ListView(Context context,
                AttributeSet attrs)

ListView

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

getMaxScrollAmount

public int getMaxScrollAmount()

addHeaderView

public void addHeaderView(View v,
                          java.lang.Object data,
                          boolean isSelectable)

addHeaderView

public void addHeaderView(View v)

getHeaderViewsCount

public int getHeaderViewsCount()

removeHeaderView

public boolean removeHeaderView(View v)

addFooterView

public void addFooterView(View v,
                          java.lang.Object data,
                          boolean isSelectable)

addFooterView

public void addFooterView(View v)

getFooterViewsCount

public int getFooterViewsCount()

removeFooterView

public boolean removeFooterView(View v)

getAdapter

public ListAdapter getAdapter()
Specified by:
getAdapter in class AdapterView<ListAdapter>

setAdapter

public void setAdapter(ListAdapter adapter)
Specified by:
setAdapter in class AdapterView<ListAdapter>

requestChildRectangleOnScreen

public boolean requestChildRectangleOnScreen(View child,
                                             Rect rect,
                                             boolean immediate)
Specified by:
requestChildRectangleOnScreen in interface ViewParent
Overrides:
requestChildRectangleOnScreen in class ViewGroup

onMeasure

protected void onMeasure(int widthMeasureSpec,
                         int heightMeasureSpec)
Overrides:
onMeasure in class AbsListView

layoutChildren

protected void layoutChildren()
Overrides:
layoutChildren in class AbsListView

canAnimate

protected boolean canAnimate()
Overrides:
canAnimate in class AdapterView<ListAdapter>

setSelection

public void setSelection(int position)
Specified by:
setSelection in class AdapterView<ListAdapter>

setSelectionFromTop

public void setSelectionFromTop(int position,
                                int y)

dispatchPopulateAccessibilityEvent

public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event)
Overrides:
dispatchPopulateAccessibilityEvent in class AdapterView<ListAdapter>

setSelectionAfterHeaderView

public void setSelectionAfterHeaderView()

dispatchKeyEvent

public boolean dispatchKeyEvent(KeyEvent event)
Overrides:
dispatchKeyEvent in class ViewGroup

onKeyDown

public boolean onKeyDown(int keyCode,
                         KeyEvent event)
Specified by:
onKeyDown in interface KeyEvent.Callback
Overrides:
onKeyDown in class AbsListView

onKeyMultiple

public boolean onKeyMultiple(int keyCode,
                             int repeatCount,
                             KeyEvent event)
Specified by:
onKeyMultiple in interface KeyEvent.Callback
Overrides:
onKeyMultiple in class View

onKeyUp

public boolean onKeyUp(int keyCode,
                       KeyEvent event)
Specified by:
onKeyUp in interface KeyEvent.Callback
Overrides:
onKeyUp in class AbsListView

setItemsCanFocus

public void setItemsCanFocus(boolean itemsCanFocus)

getItemsCanFocus

public boolean getItemsCanFocus()

setCacheColorHint

public void setCacheColorHint(int color)
Overrides:
setCacheColorHint in class AbsListView

dispatchDraw

protected void dispatchDraw(Canvas canvas)
Overrides:
dispatchDraw in class AbsListView

getDivider

public Drawable getDivider()

setDivider

public void setDivider(Drawable divider)

getDividerHeight

public int getDividerHeight()

setDividerHeight

public void setDividerHeight(int height)

setHeaderDividersEnabled

public void setHeaderDividersEnabled(boolean headerDividersEnabled)

setFooterDividersEnabled

public void setFooterDividersEnabled(boolean footerDividersEnabled)

onFocusChanged

protected void onFocusChanged(boolean gainFocus,
                              int direction,
                              Rect previouslyFocusedRect)
Overrides:
onFocusChanged in class AbsListView

onFinishInflate

protected void onFinishInflate()
Overrides:
onFinishInflate in class View

findViewTraversal

protected View findViewTraversal(int id)

findViewWithTagTraversal

protected View findViewWithTagTraversal(java.lang.Object tag)

onTouchEvent

public boolean onTouchEvent(MotionEvent ev)
Overrides:
onTouchEvent in class AbsListView

getChoiceMode

public int getChoiceMode()

setChoiceMode

public void setChoiceMode(int choiceMode)

performItemClick

public boolean performItemClick(View view,
                                int position,
                                long id)
Overrides:
performItemClick in class AdapterView<ListAdapter>

setItemChecked

public void setItemChecked(int position,
                           boolean value)

isItemChecked

public boolean isItemChecked(int position)

getCheckedItemPosition

public int getCheckedItemPosition()

getCheckedItemPositions

public SparseBooleanArray getCheckedItemPositions()

getCheckItemIds

public long[] getCheckItemIds()

clearChoices

public void clearChoices()

onSaveInstanceState

public Parcelable onSaveInstanceState()
Overrides:
onSaveInstanceState in class AbsListView

onRestoreInstanceState

public void onRestoreInstanceState(Parcelable state)
Overrides:
onRestoreInstanceState in class AbsListView


Copyright © 2008-2010. All Rights Reserved.