Added in API level 1

AbsListView


abstract class AbsListView : AdapterView<ListAdapter!>, Filter.FilterListener, TextWatcher, ViewTreeObserver.OnGlobalLayoutListener, ViewTreeObserver.OnTouchModeChangeListener
kotlin.Any
   ↳ android.view.View
   ↳ android.view.ViewGroup
   ↳ android.widget.AdapterView<android.widget.ListAdapter>
   ↳ android.widget.AbsListView

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

Summary

Nested classes
open

AbsListView extends LayoutParams to provide a place to hold the view type.

abstract

A MultiChoiceModeListener receives events for AbsListView.CHOICE_MODE_MULTIPLE_MODAL.

abstract

Interface definition for a callback to be invoked when the list or grid has been scrolled.

abstract

A RecyclerListener is used to receive a notification whenever a View is placed inside the RecycleBin's scrap heap.

abstract

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
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 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 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 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.
Inherited XML attributes
Constants
static Int

The list allows multiple choices

static Int

The list allows multiple choices in a modal selection mode

static Int

Normal list that does not indicate choices

static Int

The list allows up to one choice

static Int

The list will automatically scroll to the bottom, no matter what items are currently visible.

static Int

Disables the transcript mode.

static Int

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.

Inherited constants
Public constructors
AbsListView(context: Context!)

AbsListView(context: Context!, attrs: AttributeSet!)

AbsListView(context: Context!, attrs: AttributeSet!, defStyleAttr: Int)

AbsListView(context: Context!, attrs: AttributeSet!, defStyleAttr: Int, defStyleRes: Int)

Public methods
open Unit

Add any touchable views that are descendants of this view (possibly including this view if it is touchable itself) to views.

open Unit

For our text watcher that is associated with the text filter.

open Unit
beforeTextChanged(s: CharSequence!, start: Int, count: Int, after: Int)

For our text watcher that is associated with the text filter.

open Boolean
canScrollList(direction: Int)

Check if the items in the list can be scrolled in a certain direction.

open Boolean

For filtering we proxy an input connection to an internal text editor, and this allows the proxying to happen.

open Unit

Clear any choices previously set

open Unit

Clear the text filter.

open Unit

This defers a notifyDataSetChanged on the pending RemoteViewsAdapter if it has not connected yet.

open Unit

Dispatches drawable hotspot changes to child views that meet at least one of the following criteria:

open Unit
draw(canvas: Canvas)

Manually render this view (and all of its children) to the given Canvas.

open Unit
fling(velocityY: Int)

Initiate a fling with the given velocity.

open AbsListView.LayoutParams!

Returns a new set of layout parameters based on the supplied attributes set.

open CharSequence!

A TYPE_VIEW_SCROLLED event should be sent whenever a scroll happens, even if the mFirstPosition and the child count have not changed.

open Int

Returns the bottom edge effect color.

open Int

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

open Int

Returns the number of items currently selected.

open LongArray!

Returns the set of checked items ids.

open Int

Returns the currently checked item.

open SparseBooleanArray!

Returns the set of checked items in the list.

open Int

open Unit

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.

open Int

List padding is the maximum of the normal view's padding and the padding of the selector.

open Int

List padding is the maximum of the normal view's padding and the padding of the selector.

open Int

List padding is the maximum of the normal view's padding and the padding of the selector.

open Int

List padding is the maximum of the normal view's padding and the padding of the selector.

open View!

open Drawable!

Returns the selector android.graphics.drawable.Drawable that is used to draw the selection in the list.

open Int

Override this if your view is known to always be drawn on top of a solid color background, and needs to draw fading edges.

open CharSequence!

Returns the list's text filter, if available.

open Int

Returns the top edge effect color.

open Int

Returns the current transcript mode.

open Int

Returns the width of the vertical scrollbar.

open Boolean

Returns if the ListView currently has a text filter.

open Unit

Causes all the views to be rebuilt and redrawn.

open Boolean

Returns whether the selection highlight drawable should be drawn on top of the item or behind it.

open Boolean

Returns true if the fast scroller is set to always show on this view.

open Boolean

Returns true if the fast scroller is enabled.

open Boolean
isItemChecked(position: Int)

Returns the checked state of the specified position.

open Boolean

Indicates whether the children's drawing cache is used during a scroll.

open Boolean

Returns whether the selected child view (from the adapter's getView) is enabled.

open Boolean

Returns the current state of the fast scroll feature.

open Boolean

Indicates whether the content of this view is pinned to, or stacked from, the bottom edge.

open Boolean

Indicates whether type filtering is enabled for this view

open Unit

Call Drawable.jumpToCurrentState() on all Drawable objects associated with this view.

open Unit

Called as the result of a call to cancelPendingInputEvents() on this view or a parent view.

open InputConnection!

Return an InputConnection for editing of the filter text.

open Unit

Notifies the end of a filtering operation.

open Boolean

Implement this method to handle generic motion events.

open Unit

Callback method to be invoked when the global layout state or the visibility of views within the view tree changes

open Unit

Initializes an AccessibilityNodeInfo with information about a particular item in the list.

open Boolean

Implement this method to intercept hover events before they are handled by child views.

open Boolean

Implement this method to intercept all touch screen motion events.

open Boolean
onKeyDown(keyCode: Int, event: KeyEvent!)

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.

open Boolean
onKeyUp(keyCode: Int, event: KeyEvent!)

Default implementation of KeyEvent.Callback.onKeyUp(): perform clicking of the view when KeyEvent.KEYCODE_DPAD_CENTER, KeyEvent.KEYCODE_ENTER or KeyEvent.KEYCODE_SPACE is released.

open Boolean
onNestedFling(target: View, velocityX: Float, velocityY: Float, consumed: Boolean)

Request a fling from a nested scroll.

open Unit
onNestedScroll(target: View, dxConsumed: Int, dyConsumed: Int, dxUnconsumed: Int, dyUnconsumed: Int)

React to a nested scroll in progress.

open Unit
onNestedScrollAccepted(child: View, target: View, axes: Int)

React to the successful claiming of a nested scroll operation.

open Unit

Populates a for content capture.

open Boolean

Called back when the adapter connects to the RemoteViewsService.

open Unit

Called back when the adapter disconnects from the RemoteViewsService.

open PointerIcon!
onResolvePointerIcon(event: MotionEvent!, pointerIndex: Int)

Resolve the pointer icon that should be used for specified pointer in the motion event.

open Unit

Hook allowing a view to re-apply a representation of its internal state that had previously been generated by onSaveInstanceState.

open Unit
onRtlPropertiesChanged(layoutDirection: Int)

Called when any RTL property (layout direction or text direction or text alignment) has been changed.

open Parcelable?

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.

open Boolean
onStartNestedScroll(child: View, target: View, nestedScrollAxes: Int)

React to a descendant view initiating a nestable scroll operation, claiming the nested scroll operation if appropriate.

open Unit
onTextChanged(s: CharSequence!, start: Int, before: Int, count: Int)

For our text watcher that is associated with the text filter.

open Boolean

Implement this method to handle pointer events.

open Unit
onTouchModeChanged(isInTouchMode: Boolean)

Callback method to be invoked when the touch mode changes.

open Unit
onWindowFocusChanged(hasWindowFocus: Boolean)

Called when the window containing this view gains or loses focus.

open Boolean
performItemClick(view: View!, position: Int, id: Long)

Call the OnItemClickListener, if it is defined.

open Int

Maps a point to a position in the list.

open Long
pointToRowId(x: Int, y: Int)

Maps a point to a the rowId of the item which intersects that point.

open Unit

Move all views (excluding headers and footers) held by this AbsListView into the supplied List.

open Unit

Called when a child does not want this parent and its ancestors to intercept touch events with ViewGroup.onInterceptTouchEvent(MotionEvent).

open Unit

Call this when something has changed which has invalidated the layout of this view.

open Unit

Scrolls the list items within the view by a specified number of pixels.

open Unit

Sets the adapter that provides the data and the views to represent the data in this widget.

open Unit

Sets the bottom edge effect color.

open Unit

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.

open Unit
setChoiceMode(choiceMode: Int)

Defines the choice behavior for the List.

open Unit

Controls whether the selection highlight drawable should be drawn on top of the item or behind it.

open Unit

Sets the edge effect color for both top and bottom edge effects.

open Unit

Set whether or not the fast scroller should always be shown in place of the standard scroll bars.

open Unit

Specifies whether fast scrolling is enabled or disabled.

open Unit
setFastScrollStyle(styleResId: Int)

Specifies the style of the fast scroller decorations.

open Unit
setFilterText(filterText: String!)

Sets the initial value for the text filter.

open Unit
setFriction(friction: Float)

The amount of friction applied to flings.

open Unit
setItemChecked(position: Int, value: Boolean)

Sets the checked state of the specified position.

open Unit

Set a MultiChoiceModeListener that will manage the lifecycle of the selection ActionMode.

open Unit

Set the listener that will receive notifications every time the list scrolls.

open Unit

Sets the recycler listener to be notified whenever a View is set aside in the recycler for later reuse.

open Unit

Sets up this AbsListView to use a remote views adapter which connects to a RemoteViewsService through the specified intent.

open Unit

Specify the style of the scrollbars.

open Unit
setScrollIndicators(up: View!, down: View!)

open Unit

Enables or disables the children's drawing cache during a scroll.

open Unit
setSelectedChildViewEnabled(selectedChildViewEnabled: Boolean)

Set whether the selected child view (from the adapter's getView) is enabled.

open Unit
setSelectionFromTop(position: Int, y: Int)

Sets the selected item and positions the selection y pixels from the top edge of the ListView.

open Unit

open Unit
setSelector(resID: Int)

Set a Drawable that should be used to highlight the currently selected item.

open Unit

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.

open Unit
setStackFromBottom(stackFromBottom: Boolean)

When stack from bottom is set to true, the list fills its content starting from the bottom of the view.

open Unit
setTextFilterEnabled(textFilterEnabled: Boolean)

Enables or disables the type filter window.

open Unit

Sets the top edge effect color.

open Unit

Puts the list or grid into transcript mode.

open Unit

Sets a scale factor for the fling velocity.

open Unit

Set the position of the vertical scroll bar.

open Boolean

Shows the context menu for this view.

open Boolean

Shows the context menu for this view anchored to the specified view-relative coordinate.

open Boolean
showContextMenuForChild(originalView: View!)

Shows the context menu for the specified view or its ancestors.

open Boolean
showContextMenuForChild(originalView: View!, x: Float, y: Float)

Shows the context menu for the specified view or its ancestors anchored to the specified view-relative coordinate.

open Unit
smoothScrollBy(distance: Int, duration: Int)

Smoothly scroll by distance pixels over duration milliseconds.

open Unit

Smoothly scroll to the specified adapter position.

open Unit
smoothScrollToPosition(position: Int, boundPosition: Int)

Smoothly scroll to the specified adapter position.

open Unit
smoothScrollToPositionFromTop(position: Int, offset: Int)

Smoothly scroll to the specified adapter position.

open Unit
smoothScrollToPositionFromTop(position: Int, offset: Int, duration: Int)

Smoothly scroll to the specified adapter position.

open Boolean

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
open Boolean

open Int

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

open Int

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

open Int

Compute the vertical range that the vertical scrollbar represents.

open Unit

Called by draw to draw the child views.

open Unit

Dispatch setPressed to all of this View's children.

open Unit

This function is called whenever the state of the view changes in such a way that it impacts the state of drawables being shown.

open ViewGroup.LayoutParams!

Returns a set of default layout parameters.

open ViewGroup.LayoutParams!

Returns a safe set of layout parameters based on the supplied layout params.

open Float

Returns the strength, or intensity, of the bottom faded edge.

open Int

Amount by which to extend the bottom fading region.

open ContextMenu.ContextMenuInfo!

Views should implement this if they have extra information to associate with the context menu.

open Int

Amount by which to extend the left fading region.

open Int

Amount by which to extend the right fading region.

open Float

Returns the strength, or intensity, of the top faded edge.

open Int

Amount by which to extend the top fading region.

open Unit

open Boolean

open Boolean

If the View draws content inside its padding and enables fading edges, it needs to support padding offsets.

open Unit

Subclasses must override this method to layout their children.

open Unit

This is called when the view is attached to a window.

open Unit

This is called when the view is detached from a window.

open Unit

Gives this view a hint about whether is displayed or not.

open Unit
onFocusChanged(gainFocus: Boolean, direction: Int, previouslyFocusedRect: Rect?)

Called by the view system when the focus state of this view changes.

open Unit
onLayout(changed: Boolean, l: Int, t: Int, r: Int, b: Int)

Subclasses should NOT override this method but layoutChildren() instead.

open Unit
onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int)

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

open Unit
onOverScrolled(scrollX: Int, scrollY: Int, clampedX: Boolean, clampedY: Boolean)

Called by overScrollBy(int,int,int,int,int,int,int,int,boolean) to respond to the results of an over-scroll operation.

open Unit
onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int)

This is called during layout when the size of this view has changed.

Inherited functions