| 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
|
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.
| Nested Classes | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| AbsListView.LayoutParams | AbsListView extends LayoutParams to provide a place to hold the view type. | ||||||||||
| AbsListView.OnScrollListener | Interface definition for a callback to be invoked when the list or grid has been scrolled. | ||||||||||
| AbsListView.RecyclerListener | A RecyclerListener is used to receive a notification whenever a View is placed inside the RecycleBin's scrap heap. | ||||||||||
| XML Attributes | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| android:cacheColorHint | Indicates that this list will always be drawn on top of solid, single-color opaque background. | ||||||||||
| 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 | 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
| |||||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Add any touchable views that are descendants of this view (possibly
including this view if it is touchable itself) to views.
| |||||||||||
For our text watcher that is associated with the text filter.
| |||||||||||
For our text watcher that is associated with the text filter.
| |||||||||||
For filtering we proxy an input connection to an internal text editor,
and this allows the proxying to happen.
| |||||||||||
Clear the text filter.
| |||||||||||
Manually render this view (and all of its children) to the given Canvas.
| |||||||||||
Returns a new set of layout parameters based on the supplied attributes set.
| |||||||||||
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
| |||||||||||
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.
| |||||||||||
List padding is the maximum of the normal view's padding and the padding of the selector.
| |||||||||||
List padding is the maximum of the normal view's padding and the padding of the selector.
| |||||||||||
List padding is the maximum of the normal view's padding and the padding of the selector.
| |||||||||||
List padding is the maximum of the normal view's padding and the padding of the selector.
| |||||||||||
Returns the selector
Drawable that is used to draw the
selection in the list. | |||||||||||
Override this if your view is known to always be drawn on top of a solid color background,
and needs to draw fading edges.
| |||||||||||
Returns the list's text filter, if available.
| |||||||||||
Returns the current transcript mode.
| |||||||||||
Returns if the ListView currently has a text filter.
| |||||||||||
Causes all the views to be rebuilt and redrawn.
| |||||||||||
Returns the current state of the fast scroll feature.
| |||||||||||
Indicates whether the children's drawing cache is used during a scroll.
| |||||||||||
Returns the current state of the fast scroll feature.
| |||||||||||
Indicates whether the content of this view is pinned to, or stacked from,
the bottom edge.
| |||||||||||
Indicates whether type filtering is enabled for this view
| |||||||||||
Return an InputConnection for editing of the filter text.
| |||||||||||
Notifies the end of a filtering operation. | |||||||||||
Callback method to be invoked when the global layout state or the visibility of views
within the view tree changes
| |||||||||||
Implement this method to intercept all touch screen motion events.
| |||||||||||
Default implementation of
KeyEvent.Callback.onKeyMultiple(): perform press of the view
when KEYCODE_DPAD_CENTER or KEYCODE_ENTER
is released, if the view is enabled and clickable. | |||||||||||
Default implementation of
KeyEvent.Callback.onKeyMultiple(): perform clicking of the view
when KEYCODE_DPAD_CENTER or
KEYCODE_ENTER is released. | |||||||||||
Hook allowing a view to re-apply a representation of its internal state that had previously
been generated by
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.
| |||||||||||
For our text watcher that is associated with the text filter.
| |||||||||||
Implement this method to handle touch screen motion events.
| |||||||||||
Callback method to be invoked when the touch mode changes.
| |||||||||||
Called when the window containing this view gains or loses focus.
| |||||||||||
Maps a point to a position in the list.
| |||||||||||
Maps a point to a the rowId of the item which intersects that point.
| |||||||||||
Move all views (excluding headers and footers) held by this AbsListView into the supplied
List.
| |||||||||||
Call this when something has changed which has invalidated the
layout of this view.
| |||||||||||
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
| |||||||||||
Controls whether the selection highlight drawable should be drawn on top of the item or
behind it.
| |||||||||||
Enables fast scrolling by letting the user quickly scroll through lists by
dragging the fast scroll thumb.
| |||||||||||
Sets the initial value for the text filter.
| |||||||||||
Set the listener that will receive notifications every time the list scrolls.
| |||||||||||
Sets the recycler listener to be notified whenever a View is set aside in
the recycler for later reuse.
| |||||||||||
Enables or disables the children's drawing cache during a scroll.
| |||||||||||
Set a Drawable that should be used to highlight the currently selected item.
| |||||||||||
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.
| |||||||||||
When stack from bottom is set to true, the list fills its content starting from
the bottom of the view.
| |||||||||||
Enables or disables the type filter window.
| |||||||||||
Puts the list or grid into transcript mode.
| |||||||||||
Bring up a context menu for the specified view or its ancestors.
| |||||||||||
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 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Compute the vertical extent of the horizontal scrollbar's thumb within the vertical range. | |||||||||||
Compute the vertical offset of the vertical scrollbar's thumb within the horizontal range. | |||||||||||
Compute the vertical range that the vertical scrollbar represents. | |||||||||||
Called by draw to draw the child views.
| |||||||||||
Dispatch setPressed to all of this View's children.
| |||||||||||
This function is called whenever the state of the view changes in such
a way that it impacts the state of drawables being shown.
| |||||||||||
Returns a safe set of layout parameters based on the supplied layout params.
| |||||||||||
Returns the strength, or intensity, of the bottom faded edge.
| |||||||||||
Views should implement this if they have extra information to associate
with the context menu.
| |||||||||||
Returns the strength, or intensity, of the top faded edge.
| |||||||||||
Indicates whether this view is in filter mode.
| |||||||||||
Subclasses must override this method to layout their children.
| |||||||||||
This is called when the view is attached to a window.
| |||||||||||
Generate the new
Drawable state for
this view. | |||||||||||
This is called when the view is detached from a window.
| |||||||||||
Called by the view system when the focus state of this view changes.
| |||||||||||
Subclasses should NOT override this method but
layoutChildren() instead. | |||||||||||
Measure the view and its content to determine the measured width and the measured height. | |||||||||||
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
| |||||||||||
From class java.lang.Object
| |||||||||||
From interface android.graphics.drawable.Drawable.Callback
| |||||||||||
From interface android.text.TextWatcher
| |||||||||||
From interface android.view.KeyEvent.Callback
| |||||||||||
From interface android.view.ViewManager
| |||||||||||
From interface android.view.ViewParent
| |||||||||||
From interface android.view.ViewTreeObserver.OnGlobalLayoutListener
| |||||||||||
From interface android.view.ViewTreeObserver.OnTouchModeChangeListener
| |||||||||||
From interface android.view.accessibility.AccessibilityEventSource
| |||||||||||
From interface android.widget.Filter.FilterListener
| |||||||||||
Indicates that this list will always be drawn on top of solid, single-color opaque background. This allows the list to optimize drawing.
Must be a color value, in the form of "#rgb", "#argb",
"#rrggbb", or "#aarrggbb".
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
This corresponds to the global attribute resource symbol cacheColorHint.
When set to true, the selector will be drawn over the selected item. Otherwise the selector is drawn behind the selected item. The default value is false.
Must be a boolean value, either "true" or "false".
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
This corresponds to the global attribute resource symbol drawSelectorOnTop.
Enables the fast scroll thumb that can be dragged to quickly scroll through the list.
Must be a boolean value, either "true" or "false".
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
This corresponds to the global attribute resource symbol fastScrollEnabled.
Drawable used to indicate the currently selected item in the list.
May be a reference to another resource, in the form "@[+][package:]type:name"
or to a theme attribute in the form "?[package:][type:]name".
May be a color value, in the form of "#rgb", "#argb",
"#rrggbb", or "#aarrggbb".
This corresponds to the global attribute resource symbol listSelector.
When set to true, the list uses a drawing cache during scrolling. This makes the rendering faster but uses more memory. The default value is true.
Must be a boolean value, either "true" or "false".
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
This corresponds to the global attribute resource symbol scrollingCache.
When set to true, the list will use a more refined calculation method based on the pixels height of the items visible on screen. This property is set to true by default but should be set to false if your adapter will display items of varying heights. When this property is set to true and your adapter displays items of varying heights, the scrollbar thumb will change size as the user scrolls through the list. When set to fale, the list will use only the number of items in the adapter and the number of items visible on screen to determine the scrollbar's properties.
Must be a boolean value, either "true" or "false".
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
This corresponds to the global attribute resource symbol smoothScrollbar.
Used by ListView and GridView to stack their content from the bottom.
Must be a boolean value, either "true" or "false".
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
This corresponds to the global attribute resource symbol stackFromBottom.
When set to true, the list will filter results as the user types. The List's adapter must support the Filterable interface for this to work.
Must be a boolean value, either "true" or "false".
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
This corresponds to the global attribute resource symbol textFilterEnabled.
Sets the transcript mode for the list. In transcript mode, the list scrolls to the bottom to make new items visible when they are added.
Must be one of the following constant values.
| Constant | Value | Description |
|---|---|---|
disabled | 0 | Disables transcript mode. This is the default value. |
normal | 1 | 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. |
alwaysScroll | 2 | The list will automatically scroll to the bottom, no matter what items are currently visible. |
This corresponds to the global attribute resource symbol transcriptMode.
The list will automatically scroll to the bottom, no matter what items are currently visible.
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.
Add any touchable views that are descendants of this view (possibly including this view if it is touchable itself) to views.
| views | Touchable views found so far |
|---|
For our text watcher that is associated with the text filter. Does nothing.
For our text watcher that is associated with the text filter. Does nothing.
For filtering we proxy an input connection to an internal text editor, and this allows the proxying to happen.
| view | The View that is making the InputMethodManager call. |
|---|
Manually render this view (and all of its children) to the given Canvas.
The view must have already done a full layout before this function is
called. When implementing a view, do not override this method; instead,
you should implement onDraw(Canvas).
| canvas | The Canvas to which the View is rendered. |
|---|
Returns a new set of layout parameters based on the supplied attributes set.
| attrs | the attributes to build the layout parameters from |
|---|
ViewGroup.LayoutParams or one
of its descendants
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
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.
By default, the rectange is the getDrawingRect(Rect))of the view. However, if your
view maintains some idea of internal selection, such as a cursor, or a selected row
or column, you should override this method and fill in a more specific rectangle.
| r | The rectangle to fill in, in this view's coordinates. |
|---|
List padding is the maximum of the normal view's padding and the padding of the selector.
List padding is the maximum of the normal view's padding and the padding of the selector.
List padding is the maximum of the normal view's padding and the padding of the selector.
List padding is the maximum of the normal view's padding and the padding of the selector.
Returns the selector Drawable that is used to draw the
selection in the list.
Override this if your view is known to always be drawn on top of a solid color background, and needs to draw fading edges. Returning a non-zero color enables the view system to optimize the drawing of the fading edges. If you do return a non-zero color, the alpha should be set to 0xFF.
Returns the list's text filter, if available.
Returns if the ListView currently has a text filter.
Returns the current state of the fast scroll feature.
Indicates whether the children's drawing cache is used during a scroll. By default, the drawing cache is enabled but this will consume more memory.
Returns the current state of the fast scroll feature.
Indicates whether the content of this view is pinned to, or stacked from, the bottom edge.
Indicates whether type filtering is enabled for this view
Return an InputConnection for editing of the filter text.
| outAttrs | Fill in with attribute information about the connection. |
|---|
Notifies the end of a filtering operation.
| count | the number of values computed by the filter |
|---|
Callback method to be invoked when the global layout state or the visibility of views within the view tree changes
Implement this method to intercept all touch screen motion events. This allows you to watch events as they are dispatched to your children, and take ownership of the current gesture at any point.
Using this function takes some care, as it has a fairly complicated
interaction with View.onTouchEvent(MotionEvent), and using it requires implementing
that method as well as this one in the correct way. Events will be
received in the following order:
ACTION_CANCEL, and all further
events will be delivered to your onTouchEvent() method and no longer
appear here.
| ev | The motion event being dispatched down the hierarchy. |
|---|
Default implementation of KeyEvent.Callback.onKeyMultiple(): perform press of the view
when KEYCODE_DPAD_CENTER or KEYCODE_ENTER
is released, if the view is enabled and clickable.
| keyCode | A key code that represents the button pressed, from
KeyEvent. |
|---|---|
| event | The KeyEvent object that defines the button action. |
Default implementation of KeyEvent.Callback.onKeyMultiple(): perform clicking of the view
when KEYCODE_DPAD_CENTER or
KEYCODE_ENTER is released.
| keyCode | A key code that represents the button pressed, from
KeyEvent. |
|---|---|
| event | The KeyEvent object that defines the button action. |
Hook allowing a view to re-apply a representation of its internal state that had previously
been generated by onSaveInstanceState(). This function will never be called with a
null state.
| state | The frozen state that had previously been returned by
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. This state should only contain information that is not persistent or can not be reconstructed later. For example, you will never store your current position on screen because that will be computed again when a new instance of the view is placed in its view hierarchy.
Some examples of things you may store here: the current cursor position in a text view (but usually not the text itself since that is stored in a content provider or other persistent storage), the currently selected item in a list view.
For our text watcher that is associated with the text filter. Performs the actual filtering as the text changes, and takes care of hiding and showing the popup displaying the currently entered filter text.
Implement this method to handle touch screen motion events.
| ev | The motion event. |
|---|
Callback method to be invoked when the touch mode changes.
| isInTouchMode | True if the view hierarchy is now in touch mode, false otherwise. |
|---|
Called when the window containing this view gains or loses focus. Note that this is separate from view focus: to receive key events, both your view and its window must have focus. If a window is displayed on top of yours that takes input focus, then your own window will lose focus but the view focus will remain unchanged.
| hasWindowFocus | True if the window containing this view now has focus, false otherwise. |
|---|
Maps a point to a position in the list.
| x | X in local coordinate |
|---|---|
| y | Y in local coordinate |
INVALID_POSITION if the point does not intersect an item.
Maps a point to a the rowId of the item which intersects that point.
| x | X in local coordinate |
|---|---|
| y | Y in local coordinate |
INVALID_ROW_ID
if the point does not intersect an item.
Move all views (excluding headers and footers) held by this AbsListView into the supplied List. This includes views displayed on the screen as well as views stored in AbsListView's internal view recycler.
| views | A list into which to put the reclaimed views |
|---|
Call this when something has changed which has invalidated the layout of this view. This will schedule a layout pass of the view tree.
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
| color | The background color |
|---|
Controls whether the selection highlight drawable should be drawn on top of the item or behind it.
| onTop | If true, the selector will be drawn on the item it is highlighting. The default is false. |
|---|
Enables fast scrolling by letting the user quickly scroll through lists by
dragging the fast scroll thumb. The adapter attached to the list may want
to implement SectionIndexer if it wishes to display alphabet preview and
jump between sections of the list.
| enabled | whether or not to enable fast scrolling |
|---|
Sets the initial value for the text filter.
| filterText | The text to use for the filter. |
|---|
Set the listener that will receive notifications every time the list scrolls.
| l | the scroll listener |
|---|
Sets the recycler listener to be notified whenever a View is set aside in the recycler for later reuse. This listener can be used to free resources associated to the View.
| listener | The recycler listener to be notified of views set aside in the recycler. |
|---|
AbsListView.RecyclerListenerEnables or disables the children's drawing cache during a scroll.
By default, the drawing cache is enabled but this will use more memory.
When the scrolling cache is enabled, the caches are kept after the
first scrolling. You can manually clear the cache by calling
setChildrenDrawingCacheEnabled(boolean).
| enabled | true to enable the scroll cache, false otherwise |
|---|
Set a Drawable that should be used to highlight the currently selected item.
| resID | A Drawable resource to use as the selection highlight. |
|---|
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. This however assumes that all list items have the same height. If you use a list in which items have different heights, the scrollbar will change appearance as the user scrolls through the list. To avoid this issue, you need to disable this property. When smooth scrollbar is disabled, the position and size of the scrollbar thumb is based solely on the number of items in the adapter and the position of the visible items inside the adapter. This provides a stable scrollbar as the user navigates through a list of items with varying heights.
| enabled | Whether or not to enable smooth scrollbar. |
|---|
When stack from bottom is set to true, the list fills its content starting from the bottom of the view.
| stackFromBottom | true to pin the view's content to the bottom edge, false to pin the view's content to the top edge |
|---|
Enables or disables the type filter window. If enabled, typing when
this view has focus will filter the children to match the users input.
Note that the Adapter used by this view must implement the
Filterable interface.
| textFilterEnabled | true to enable type filtering, false otherwise |
|---|
Puts the list or grid into transcript mode. In this mode the list or grid will