java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.widget.AdapterView<T extends android.widget.Adapter>
         ↳ android.widget.AbsListView
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

Base class that can be used to implement virtualized lists of items. A list does not have a spatial definition here. For instance, subclases of this class can display the content of the list in a grid, in a carousel, as stack, etc.

Summary

Nested Classes
class AbsListView.LayoutParams AbsListView extends LayoutParams to provide a place to hold the view type. 
interface AbsListView.MultiChoiceModeListener A MultiChoiceModeListener receives events for CHOICE_MODE_MULTIPLE_MODAL
interface AbsListView.OnScrollListener Interface definition for a callback to be invoked when the list or grid has been scrolled. 
interface AbsListView.RecyclerListener A RecyclerListener is used to receive a notification whenever a View is placed inside the RecycleBin's scrap heap. 
interface AbsListView.SelectionBoundsAdjuster The top-level view of a list item can implement this interface to allow itself to modify the bounds of the selection shown for that item. 
XML Attributes
Attribute Name Related Method Description
android:cacheColorHint Indicates that this list will always be drawn on top of solid, single-color opaque background. 
android:choiceMode Defines the choice behavior for the view. 
android:drawSelectorOnTop setDrawSelectorOnTop(boolean) When set to true, the selector will be drawn over the selected item. 
android:fastScrollEnabled Enables the fast scroll thumb that can be dragged to quickly scroll through the list. 
android:listSelector setSelector(int) Drawable used to indicate the currently selected item in the list. 
android:scrollingCache When set to true, the list uses a drawing cache during scrolling. 
android:smoothScrollbar setSmoothScrollbarEnabled(boolean) When set to true, the list will use a more refined calculation method based on the pixels height of the items visible on screen. 
android:stackFromBottom Used by ListView and GridView to stack their content from the bottom. 
android:textFilterEnabled When set to true, the list will filter results as the user types. 
android:transcriptMode Sets the transcript mode for the list. 
[Expand]
Inherited XML Attributes
From class android.view.ViewGroup
From class android.view.View
Constants
int CHOICE_MODE_MULTIPLE The list allows multiple choices
int CHOICE_MODE_MULTIPLE_MODAL The list allows multiple choices in a modal selection mode
int CHOICE_MODE_NONE Normal list that does not indicate choices
int CHOICE_MODE_SINGLE The list allows up to one choice
int TRANSCRIPT_MODE_ALWAYS_SCROLL The list will automatically scroll to the bottom, no matter what items are currently visible.
int TRANSCRIPT_MODE_DISABLED Disables the transcript mode.
int TRANSCRIPT_MODE_NORMAL The list will automatically scroll to the bottom when a data set change notification is received and only if the last item is already visible on screen.
[Expand]
Inherited Constants
From class android.widget.AdapterView
From class android.view.ViewGroup
From class android.view.View
[Expand]
Inherited Fields
From class android.view.View
Public Constructors
AbsListView(Context context)
AbsListView(Context context, AttributeSet attrs)
AbsListView(Context context, AttributeSet attrs, int defStyle)
Public Methods
void addTouchables(ArrayList<View> views)
Add any touchable views that are descendants of this view (possibly including this view if it is touchable itself) to views.
void afterTextChanged(Editable s)
For our text watcher that is associated with the text filter.
void beforeTextChanged(CharSequence s, int start, int count, int after)
For our text watcher that is associated with the text filter.
boolean checkInputConnectionProxy(View view)
For filtering we proxy an input connection to an internal text editor, and this allows the proxying to happen.
void clearChoices()
Clear any choices previously set
void clearTextFilter()
Clear the text filter.
void deferNotifyDataSetChanged()
This defers a notifyDataSetChanged on the pending RemoteViewsAdapter if it has not connected yet.
void draw(Canvas canvas)
Manually render this view (and all of its children) to the given Canvas.
AbsListView.LayoutParams generateLayoutParams(AttributeSet attrs)
Returns a new set of layout parameters based on the supplied attributes set.
int getCacheColorHint()
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
int getCheckedItemCount()
Returns the number of items currently selected.
long[] getCheckedItemIds()
Returns the set of checked items ids.
int getCheckedItemPosition()
Returns the currently checked item.
SparseBooleanArray getCheckedItemPositions()
Returns the set of checked items in the list.
int getChoiceMode()
void getFocusedRect(Rect r)
When a view has focus and the user navigates away from it, the next view is searched for starting from the rectangle filled in by this method.
int getListPaddingBottom()
List padding is the maximum of the normal view's padding and the padding of the selector.
int getListPaddingLeft()
List padding is the maximum of the normal view's padding and the padding of the selector.
int getListPaddingRight()
List padding is the maximum of the normal view's padding and the padding of the selector.
int getListPaddingTop()
List padding is the maximum of the normal view's padding and the padding of the selector.
View getSelectedView()
Drawable getSelector()
Returns the selector Drawable that is used to draw the selection in the list.
int getSolidColor()
Override this if your view is known to always be drawn on top of a solid color background, and needs to draw fading edges.
CharSequence getTextFilter()
Returns the list's text filter, if available.
int getTranscriptMode()
Returns the current transcript mode.
int getVerticalScrollbarWidth()
Returns the width of the vertical scrollbar.
boolean hasTextFilter()
Returns if the ListView currently has a text filter.
void invalidateViews()
Causes all the views to be rebuilt and redrawn.
boolean isFastScrollAlwaysVisible()
Returns true if the fast scroller is set to always show on this view rather than fade out when not in use.
boolean isFastScrollEnabled()
Returns the current state of the fast scroll feature.
boolean isItemChecked(int position)
Returns the checked state of the specified position.
boolean isScrollingCacheEnabled()
Indicates whether the children's drawing cache is used during a scroll.
boolean isSmoothScrollbarEnabled()
Returns the current state of the fast scroll feature.
boolean isStackFromBottom()
Indicates whether the content of this view is pinned to, or stacked from, the bottom edge.
boolean isTextFilterEnabled()
Indicates whether type filtering is enabled for this view
void jumpDrawablesToCurrentState()
Call Drawable.jumpToCurrentState() on all Drawable objects associated with this view.
InputConnection onCreateInputConnection(EditorInfo outAttrs)
Return an InputConnection for editing of the filter text.
void onFilterComplete(int count)

Notifies the end of a filtering operation.

boolean onGenericMotionEvent(MotionEvent event)
Implement this method to handle generic motion events.
void onGlobalLayout()
Callback method to be invoked when the global layout state or the visibility of views within the view tree changes
boolean onInterceptTouchEvent(MotionEvent ev)
Implement this method to intercept all touch screen motion events.
boolean onKeyDown(int keyCode, KeyEvent event)
Default implementation of KeyEvent.Callback.onKeyDown(): perform press of the view when KEYCODE_DPAD_CENTER or KEYCODE_ENTER is released, if the view is enabled and clickable.
boolean onKeyUp(int keyCode, KeyEvent event)
Default implementation of KeyEvent.Callback.onKeyUp(): perform clicking of the view when KEYCODE_DPAD_CENTER or KEYCODE_ENTER is released.
boolean onRemoteAdapterConnected()
Called back when the adapter connects to the RemoteViewsService.
void onRemoteAdapterDisconnected()
Called back when the adapter disconnects from the RemoteViewsService.
void onRestoreInstanceState(Parcelable state)
Hook allowing a view to re-apply a representation of its internal state that had previously been generated by onSaveInstanceState().
Parcelable onSaveInstanceState()
Hook allowing a view to generate a representation of its internal state that can later be used to create a new instance with that same state.
void onTextChanged(CharSequence s, int start, int before, int count)
For our text watcher that is associated with the text filter.
boolean onTouchEvent(MotionEvent ev)
Implement this method to handle touch screen motion events.
void onTouchModeChanged(boolean isInTouchMode)
Callback method to be invoked when the touch mode changes.
void onWindowFocusChanged(boolean hasWindowFocus)
Called when the window containing this view gains or loses focus.
boolean performItemClick(View view, int position, long id)
Call the OnItemClickListener, if it is defined.
int pointToPosition(int x, int y)
Maps a point to a position in the list.
long pointToRowId(int x, int y)
Maps a point to a the rowId of the item which intersects that point.
void reclaimViews(List<View> views)
Move all views (excluding headers and footers) held by this AbsListView into the supplied List.
void requestDisallowInterceptTouchEvent(boolean disallowIntercept)
Called when a child does not want this parent and its ancestors to intercept touch events with onInterceptTouchEvent(MotionEvent).
void requestLayout()
Call this when something has changed which has invalidated the layout of this view.
void sendAccessibilityEvent(int eventType)
Sends an accessibility event of the given type.
void setAdapter(ListAdapter adapter)
Sets the adapter that provides the data and the views to represent the data in this widget.
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 setChoiceMode(int choiceMode)
Defines the choice behavior for the List.
void setDrawSelectorOnTop(boolean onTop)
Controls whether the selection highlight drawable should be drawn on top of the item or behind it.
void setFastScrollAlwaysVisible(boolean alwaysShow)
Set whether or not the fast scroller should always be shown in place of the standard scrollbars.
void setFastScrollEnabled(boolean enabled)
Enables fast scrolling by letting the user quickly scroll through lists by dragging the fast scroll thumb.
void setFilterText(String filterText)
Sets the initial value for the text filter.
void setFriction(float friction)
The amount of friction applied to flings.
void setItemChecked(int position, boolean value)
Sets the checked state of the specified position.
void setMultiChoiceModeListener(AbsListView.MultiChoiceModeListener listener)
Set a AbsListView.MultiChoiceModeListener that will manage the lifecycle of the selection ActionMode.
void setOnScrollListener(AbsListView.OnScrollListener l)
Set the listener that will receive notifications every time the list scrolls.
void setOverScrollMode(int mode)
Set the over-scroll mode for this view.
void setRecyclerListener(AbsListView.RecyclerListener listener)
Sets the recycler listener to be notified whenever a View is set aside in the recycler for later reuse.
void setRemoteViewsAdapter(Intent intent)
Sets up this AbsListView to use a remote views adapter which connects to a RemoteViewsService through the specified intent.
void setScrollIndicators(View up, View down)
void setScrollingCacheEnabled(boolean enabled)
Enables or disables the children's drawing cache during a scroll.
void setSelector(Drawable sel)
void setSelector(int resID)
Set a Drawable that should be used to highlight the currently selected item.
void setSmoothScrollbarEnabled(boolean enabled)
When smooth scrollbar is enabled, the position and size of the scrollbar thumb is computed based on the number of visible pixels in the visible items.
void setStackFromBottom(boolean stackFromBottom)
When stack from bottom is set to true, the list fills its content starting from the bottom of the view.
void setTextFilterEnabled(boolean textFilterEnabled)
Enables or disables the type filter window.
void setTranscriptMode(int mode)
Puts the list or grid into transcript mode.
void setVelocityScale(float scale)
Sets a scale factor for the fling velocity.
void setVerticalScrollbarPosition(int position)
Set the position of the vertical scroll bar.
boolean showContextMenuForChild(View originalView)
Bring up a context menu for the specified view or its ancestors.
void smoothScrollBy(int distance, int duration)
Smoothly scroll by distance pixels over duration milliseconds.
void smoothScrollToPosition(int position)
Smoothly scroll to the specified adapter position.
void smoothScrollToPosition(int position, int boundPosition)
Smoothly scroll to the specified adapter position.
void smoothScrollToPositionFromTop(int position, int offset, int duration)
Smoothly scroll to the specified adapter position.
void smoothScrollToPositionFromTop(int position, int offset)
Smoothly scroll to the specified adapter position.
boolean verifyDrawable(Drawable dr)
If your view subclass is displaying its own Drawable objects, it should override this function and return true for any Drawable it is displaying.
Protected Methods
boolean checkLayoutParams(ViewGroup.LayoutParams p)
int computeVerticalScrollExtent()

Compute the vertical extent of the horizontal scrollbar's thumb within the vertical range.

int computeVerticalScrollOffset()

Compute the vertical offset of the vertical scrollbar's thumb within the horizontal range.

int computeVerticalScrollRange()

Compute the vertical range that the vertical scrollbar represents.

void dispatchDraw(Canvas canvas)
Called by draw to draw the child views.
void dispatchSetPressed(boolean pressed)
Dispatch setPressed to all of this View's children.
void drawableStateChanged()
This function is called whenever the state of the view changes in such a way that it impacts the state of drawables being shown.
ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams p)
Returns a safe set of layout parameters based on the supplied layout params.
float getBottomFadingEdgeStrength()
Returns the strength, or intensity, of the bottom faded edge.
int getBottomPaddingOffset()
Amount by which to extend the bottom fading region.
ContextMenu.ContextMenuInfo getContextMenuInfo()
Views should implement this if they have extra information to associate with the context menu.
int getLeftPaddingOffset()
Amount by which to extend the left fading region.
int getRightPaddingOffset()
Amount by which to extend the right fading region.
float getTopFadingEdgeStrength()
Returns the strength, or intensity, of the top faded edge.
int getTopPaddingOffset()
Amount by which to extend the top fading region.
void handleDataChanged()
boolean isInFilterMode()
Indicates whether this view is in filter mode.
boolean isPaddingOffsetRequired()
If the View draws content inside its padding and enables fading edges, it needs to support padding offsets.
void layoutChildren()
Subclasses must override this method to layout their children.
void onAttachedToWindow()
This is called when the view is attached to a window.
int[] onCreateDrawableState(int extraSpace)
Generate the new Drawable state for this view.
void onDetachedFromWindow()
This is called when the view is detached from a window.
void onDisplayHint(int hint)
Gives this view a hint about whether is displayed or not.
void onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect)
Called by the view system when the focus state of this view changes.
void onLayout(boolean changed, int l, int t, int r, int b)
Subclasses should NOT override this method but layoutChildren() instead.
void onMeasure(int widthMeasureSpec, int heightMeasureSpec)

Measure the view and its content to determine the measured width and the measured height.

void onOverScrolled(int scrollX, int scrollY, boolean clampedX, boolean clampedY)
Called by overScrollBy(int, int, int, int, int, int, int, int, boolean) to respond to the results of an over-scroll operation.
void onSizeChanged(int w, int h, int oldw, int oldh)
This is called during layout when the size of this view has changed.
[Expand]
Inherited Methods
From class android.widget.AdapterView
From class android.view.ViewGroup
From class android.view.View