Added in API level 1

AbsListView

abstract class AbsListView : AdapterView<ListAdapter!>, TextWatcher, ViewTreeObserver.OnGlobalLayoutListener, Filter.FilterListener, 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

open Unit
draw(canvas: Canvas)

open Unit
fling(velocityY: Int)

Initiate a fling with the given velocity.

open AbsListView.LayoutParams!

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

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

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

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

open Unit

open InputConnection!

Return an InputConnection for editing of the filter text.

open Unit

open Boolean

open Unit

open Unit

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

open Boolean

open Boolean

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

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

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

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

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

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)

open Unit

open Unit
onRtlPropertiesChanged(layoutDirection: Int)

open Parcelable?

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

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

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

open Boolean

open Unit
onTouchModeChanged(isInTouchMode: Boolean)

open Unit
onWindowFocusChanged(hasWindowFocus: Boolean)

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

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

open Unit

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

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
setSelector(resID: Int)

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

open Unit

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

open Boolean

open Boolean

open Boolean
showContextMenuForChild(originalView: View!)

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

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, duration: Int)

Smoothly scroll to the specified adapter position.

open Unit
smoothScrollToPositionFromTop(position: Int, offset: 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

open Int

open Int

open Unit

open Unit

open Unit

open ViewGroup.LayoutParams!

open ViewGroup.LayoutParams!

open Float

open Int

open ContextMenu.ContextMenuInfo!

open Int

open Int

open Float

open Int

open Unit

open Boolean

open Boolean

open Unit

Subclasses must override this method to layout their children.

open Unit

open Unit

open Unit

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

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)

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

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

Inherited functions
Inherited properties

XML attributes

android:cacheColorHint

android:cacheColorHint
Indicates that this list will always be drawn on top of solid, single-color opaque background. This allows the list to optimize drawing.

May be a color value, in the form of "rgb", "argb", "rrggbb", or "aarrggbb".

android:choiceMode

android:choiceMode
Defines the choice behavior for the view. By default, lists do not have any choice behavior. By setting the choiceMode to singleChoice, the list allows up to one item to be in a chosen state. By setting the choiceMode to multipleChoice, the list allows any number of items to be chosen. Finally, by setting the choiceMode to multipleChoiceModal the list allows any number of items to be chosen in a special selection mode. The application will supply a android.widget.AbsListView.MultiChoiceModeListener using android.widget.AbsListView#setMultiChoiceModeListener to control the selection mode. This uses the android.view.ActionMode API.

Must be one of the following constant values.

Constant Value Description
multipleChoice 2 The list allows multiple choices.
multipleChoiceModal 3 The list allows multiple choices in a custom selection mode.
none 0 Normal list that does not indicate choices.
singleChoice 1 The list allows up to one choice.

android:drawSelectorOnTop

android:drawSelectorOnTop
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.

May be a boolean value, such as "true" or "false".

android:fastScrollEnabled

android:fastScrollEnabled
Enables the fast scroll thumb that can be dragged to quickly scroll through the list.

May be a boolean value, such as "true" or "false".

android:listSelector

android:listSelector
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 a theme attribute in the form "?[package:]type/name".

May be a color value, in the form of "rgb", "argb", "rrggbb", or "aarrggbb".

android:scrollingCache

android:scrollingCache
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.

May be a boolean value, such as "true" or "false".

android:smoothScrollbar

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. 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 false, 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.

May be a boolean value, such as "true" or "false".

android:stackFromBottom

android:stackFromBottom
Used by ListView and GridView to stack their content from the bottom.

May be a boolean value, such as "true" or "false".

android:textFilterEnabled

android:textFilterEnabled
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.

May be a boolean value, such as "true" or "false".

android:transcriptMode

android:transcriptMode
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
alwaysScroll 2 The list will automatically scroll to the bottom, no matter what items are currently visible.
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.

Constants

CHOICE_MODE_MULTIPLE

Added in API level 11
static val CHOICE_MODE_MULTIPLE: Int

The list allows multiple choices

Value: 2

CHOICE_MODE_MULTIPLE_MODAL

Added in API level 11
static val CHOICE_MODE_MULTIPLE_MODAL: Int

The list allows multiple choices in a modal selection mode

Value: 3

CHOICE_MODE_NONE

Added in API level 11
static val CHOICE_MODE_NONE: Int

Normal list that does not indicate choices

Value: 0

CHOICE_MODE_SINGLE

Added in API level 11
static val CHOICE_MODE_SINGLE: Int

The list allows up to one choice

Value: 1

TRANSCRIPT_MODE_ALWAYS_SCROLL

Added in API level 1
static val TRANSCRIPT_MODE_ALWAYS_SCROLL: Int

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

Value: 2

TRANSCRIPT_MODE_DISABLED

Added in API level 1
static val TRANSCRIPT_MODE_DISABLED: Int

Disables the transcript mode.

Value: 0

TRANSCRIPT_MODE_NORMAL

Added in API level 1
static val TRANSCRIPT_MODE_NORMAL: 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.

Value: 1

Public constructors

AbsListView

Added in API level 1
AbsListView(context: Context!)

AbsListView

Added in API level 1
AbsListView(
    context: Context!,
    attrs: AttributeSet!)

AbsListView

Added in API level 1
AbsListView(
    context: Context!,
    attrs: AttributeSet!,
    defStyleAttr: Int)

AbsListView

Added in API level 1
AbsListView(
    context: Context!,
    attrs: AttributeSet!,
    defStyleAttr: Int,
    defStyleRes: Int)

Public methods

addTouchables

Added in API level 1
open fun addTouchables(views: ArrayList<View!>!): Unit

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

Parameters
views ArrayList<View!>!: Touchable views found so far

afterTextChanged

Added in API level 1
open fun afterTextChanged(s: Editable!): Unit

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

beforeTextChanged

Added in API level 1
open fun beforeTextChanged(
    s: CharSequence!,
    start: Int,
    count: Int,
    after: Int
): Unit

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

canScrollList

Added in API level 19
open fun canScrollList(direction: Int): Boolean

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

Parameters
direction Int: Negative to check scrolling up, positive to check scrolling down.
Return
Boolean true if the list can be scrolled in the specified direction, false otherwise.

checkInputConnectionProxy

Added in API level 3
open fun checkInputConnectionProxy(view: View!): Boolean

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

Parameters
view View!: The View that is making the InputMethodManager call.
Return
Boolean Return true to allow the call, false to reject.

clearChoices

Added in API level 11
open fun clearChoices(): Unit

Clear any choices previously set

clearTextFilter

Added in API level 1
open fun clearTextFilter(): Unit

Clear the text filter.

deferNotifyDataSetChanged

Added in API level 14
open fun deferNotifyDataSetChanged(): Unit

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

dispatchDrawableHotspotChanged

Added in API level 22
open fun dispatchDrawableHotspotChanged(
    x: Float,
    y: Float
): Unit
Parameters
x Float: hotspot x coordinate
y Float: hotspot y coordinate

draw

Added in API level 1
open fun draw(canvas: Canvas): Unit
Parameters
canvas Canvas: The Canvas to which the View is rendered. This value cannot be null.

fling

Added in API level 21
open fun fling(velocityY: Int): Unit

Initiate a fling with the given velocity.

Applications can use this method to manually initiate a fling as if the user initiated it via touch interaction.

Parameters
velocityY Int: Vertical velocity in pixels per second. Note that this is velocity of content, not velocity of a touch that initiated the fling.

generateLayoutParams

Added in API level 1
open fun generateLayoutParams(attrs: AttributeSet!): AbsListView.LayoutParams!
Parameters
attrs AttributeSet!: the attributes to build the layout parameters from
Return
AbsListView.LayoutParams! an instance of android.view.ViewGroup.LayoutParams or one of its descendants

getAccessibilityClassName

Added in API level 23
open fun getAccessibilityClassName(): CharSequence!

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

getBottomEdgeEffectColor

Added in API level 29
open fun getBottomEdgeEffectColor(): Int

Returns the bottom edge effect color.

Return
Int The bottom edge effect color.

getCacheColorHint

Added in API level 1
open fun getCacheColorHint(): 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

Return
Int The cache color hint

getCheckedItemCount

Added in API level 11
open fun getCheckedItemCount(): Int

Returns the number of items currently selected. This will only be valid if the choice mode is not CHOICE_MODE_NONE (default).

To determine the specific items that are currently selected, use one of the getChecked* methods.

Return
Int The number of items currently selected

getCheckedItemIds

Added in API level 11
open fun getCheckedItemIds(): LongArray!

Returns the set of checked items ids. The result is only valid if the choice mode has not been set to CHOICE_MODE_NONE and the adapter has stable IDs. (ListAdapter#hasStableIds() == true)

Return
LongArray! A new array which contains the id of each checked item in the list.

getCheckedItemPosition

Added in API level 11
open fun getCheckedItemPosition(): Int

Returns the currently checked item. The result is only valid if the choice mode has been set to CHOICE_MODE_SINGLE.

Return
Int The position of the currently checked item or INVALID_POSITION if nothing is selected

getCheckedItemPositions

Added in API level 11
open fun getCheckedItemPositions(): SparseBooleanArray!

Returns the set of checked items in the list. The result is only valid if the choice mode has not been set to CHOICE_MODE_NONE.

Return
SparseBooleanArray! A SparseBooleanArray which will return true for each call to get(int position) where position is a checked position in the list and false otherwise, or null if the choice mode is set to CHOICE_MODE_NONE.

getChoiceMode

Added in API level 11
open fun getChoiceMode(): Int
Return
Int The current choice mode

getFocusedRect

Added in API level 1
open fun getFocusedRect(r: Rect!): Unit
Parameters
r Rect!: The rectangle to fill in, in this view's coordinates.

getListPaddingBottom

Added in API level 1
open fun getListPaddingBottom(): Int

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

Return
Int The bottom list padding.

getListPaddingLeft

Added in API level 1
open fun getListPaddingLeft(): Int

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

Return
Int The left list padding.

getListPaddingRight

Added in API level 1
open fun getListPaddingRight(): Int

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

Return
Int The right list padding.

getListPaddingTop

Added in API level 1
open fun getListPaddingTop(): Int

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

Return
Int The top list padding.

getSelectedView

Added in API level 1
open fun getSelectedView(): View!
Return
View! The view corresponding to the currently selected item, or null if nothing is selected

getSelector

Added in API level 1
open fun getSelector(): Drawable!

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

Return
Drawable! the drawable used to display the selector

getSolidColor

Added in API level 1
open fun getSolidColor(): Int
Return
Int The known solid color background for this view, or 0 if the color may vary

getTextFilter

Added in API level 3
open fun getTextFilter(): CharSequence!

Returns the list's text filter, if available.

Return
CharSequence! the list's text filter or null if filtering isn't enabled

getTopEdgeEffectColor

Added in API level 29
open fun getTopEdgeEffectColor(): Int

Returns the top edge effect color.

Return
Int The top edge effect color.

getTranscriptMode

Added in API level 1
open fun getTranscriptMode(): Int

Returns the current transcript mode.

Return
Int TRANSCRIPT_MODE_DISABLED, TRANSCRIPT_MODE_NORMAL or TRANSCRIPT_MODE_ALWAYS_SCROLL

getVerticalScrollbarWidth

Added in API level 1
open fun getVerticalScrollbarWidth(): Int
Return
Int The width in pixels of the vertical scrollbar or 0 if there is no vertical scrollbar.

hasTextFilter

Added in API level 1
open fun hasTextFilter(): Boolean

Returns if the ListView currently has a text filter.

invalidateViews

Added in API level 1
open fun invalidateViews(): Unit

Causes all the views to be rebuilt and redrawn.

isDrawSelectorOnTop

Added in API level 29
open fun isDrawSelectorOnTop(): Boolean

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

Return
Boolean true if selector is drawn on top, false otherwise

isFastScrollAlwaysVisible

Added in API level 11
open fun isFastScrollAlwaysVisible(): Boolean

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

Return
Boolean true if the fast scroller will always show

isFastScrollEnabled

Added in API level 3
open fun isFastScrollEnabled(): Boolean

Returns true if the fast scroller is enabled.

Return
Boolean true if fast scroll is enabled, false otherwise

isItemChecked

Added in API level 11
open fun isItemChecked(position: Int): Boolean

Returns the checked state of the specified position. The result is only valid if the choice mode has been set to CHOICE_MODE_SINGLE or CHOICE_MODE_MULTIPLE.

Parameters
position Int: The item whose checked state to return
Return
Boolean The item's checked state or false if choice mode is invalid

isScrollingCacheEnabled

Added in API level 1
open fun isScrollingCacheEnabled(): Boolean

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.

Return
Boolean true if the scrolling cache is enabled, false otherwise

isSelectedChildViewEnabled

Added in API level 33
open fun isSelectedChildViewEnabled(): Boolean

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

Return
Boolean true if enabled

isSmoothScrollbarEnabled

Added in API level 3
open fun isSmoothScrollbarEnabled(): Boolean

Returns the current state of the fast scroll feature.

Return
Boolean True if smooth scrollbar is enabled is enabled, false otherwise.

isStackFromBottom

Added in API level 1
open fun isStackFromBottom(): Boolean

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

Return
Boolean true if the content is stacked from the bottom edge, false otherwise

isTextFilterEnabled

Added in API level 1
open fun isTextFilterEnabled(): Boolean

Indicates whether type filtering is enabled for this view

Return
Boolean true if type filtering is enabled, false otherwise

jumpDrawablesToCurrentState

Added in API level 11
open fun jumpDrawablesToCurrentState(): Unit

onCancelPendingInputEvents

Added in API level 19
open fun onCancelPendingInputEvents(): Unit

onCreateInputConnection

Added in API level 3
open fun onCreateInputConnection(outAttrs: EditorInfo!): InputConnection!

Return an InputConnection for editing of the filter text.

Parameters
outAttrs EditorInfo!: Fill in with attribute information about the connection.

onFilterComplete

Added in API level 1
open fun onFilterComplete(count: Int): Unit
Parameters
count Int: the number of values computed by the filter

onGenericMotionEvent

Added in API level 12
open fun onGenericMotionEvent(event: MotionEvent!): Boolean
Parameters
event MotionEvent!: The generic motion event being processed.
Return
Boolean True if the event was handled, false otherwise.

onGlobalLayout

Added in API level 1
open fun onGlobalLayout(): Unit

onInitializeAccessibilityNodeInfoForItem

Added in API level 19
open fun onInitializeAccessibilityNodeInfoForItem(
    view: View!,
    position: Int,
    info: AccessibilityNodeInfo!
): Unit

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

Parameters
view View!: View representing the list item.
position Int: Position of the list item within the adapter.
info AccessibilityNodeInfo!: Node info to populate.

onInterceptHoverEvent

Added in API level 14
open fun onInterceptHoverEvent(event: MotionEvent!): Boolean
Parameters
event MotionEvent!: The motion event that describes the hover.
Return
Boolean True if the view group would like to intercept the hover event and prevent its children from receiving it.

onInterceptTouchEvent

Added in API level 1
open fun onInterceptTouchEvent(ev: MotionEvent!): Boolean
Parameters
ev MotionEvent!: The motion event being dispatched down the hierarchy.
Return
Boolean Return true to steal motion events from the children and have them dispatched to this ViewGroup through onTouchEvent(). The current target will receive an ACTION_CANCEL event, and no further messages will be delivered here.

onKeyDown

Added in API level 1
open fun onKeyDown(
    keyCode: Int,
    event: KeyEvent!
): Boolean
Parameters
keyCode Int: a key code that represents the button pressed, from android.view.KeyEvent
event KeyEvent!: the KeyEvent object that defines the button action
Return
Boolean If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false.

onKeyUp

Added in API level 1
open fun onKeyUp(
    keyCode: Int,
    event: KeyEvent!
): Boolean
Parameters
keyCode Int: A key code that represents the button pressed, from android.view.KeyEvent.
event KeyEvent!: The KeyEvent object that defines the button action.
Return
Boolean If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false.

onNestedFling

Added in API level 21
open fun onNestedFling(
    target: View,
    velocityX: Float,
    velocityY: Float,
    consumed: Boolean
): Boolean
Parameters
target View: View that initiated the nested scroll This value cannot be null.
velocityX Float: Horizontal velocity in pixels per second
velocityY Float: Vertical velocity in pixels per second
consumed Boolean: true if the child consumed the fling, false otherwise
Return
Boolean true if this parent consumed or otherwise reacted to the fling

onNestedScroll

Added in API level 21
open fun onNestedScroll(
    target: View,
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int
): Unit
Parameters
target View: The descendent view controlling the nested scroll This value cannot be null.
dxConsumed Int: Horizontal scroll distance in pixels already consumed by target
dyConsumed Int: Vertical scroll distance in pixels already consumed by target
dxUnconsumed Int: Horizontal scroll distance in pixels not consumed by target
dyUnconsumed Int: Vertical scroll distance in pixels not consumed by target

onNestedScrollAccepted

Added in API level 21
open fun onNestedScrollAccepted(
    child: View,
    target: View,
    axes: Int
): Unit
Parameters
child View: Direct child of this ViewParent containing target This value cannot be null.
target View: View that initiated the nested scroll This value cannot be null.
nestedScrollAxes Flags consisting of View#SCROLL_AXIS_HORIZONTAL, View#SCROLL_AXIS_VERTICAL or both

onProvideContentCaptureStructure

Added in API level 30
open fun onProvideContentCaptureStructure(
    structure: ViewStructure,
    flags: Int
): Unit

Populates a for content capture.

This method is called after a view that is eligible for content capture (for example, if it isImportantForContentCapture(), an intelligence service is enabled for the user, and the activity rendering the view is enabled for content capture) is laid out and is visible. The populated structure is then passed to the service through ContentCaptureSession#notifyViewAppeared(ViewStructure).

The default implementation of this method sets the most relevant properties based on related View methods, and views in the standard Android widgets library also override it to set their relevant properties. Therefore, if overriding this method, it is recommended to call super.onProvideContentCaptureStructure().

Note: views that manage a virtual structure under this view must populate just the node representing this view and return right away, then asynchronously report (not necessarily in the UI thread) when the children nodes appear, disappear or have their text changed by calling ContentCaptureSession#notifyViewAppeared(ViewStructure), ContentCaptureSession#notifyViewDisappeared(AutofillId), and ContentCaptureSession#notifyViewTextChanged(AutofillId, CharSequence) respectively. The structure for a child must be created using ContentCaptureSession#newVirtualViewStructure(AutofillId, long), and the autofillId for a child can be obtained either through childStructure.getAutofillId() or ContentCaptureSession#newAutofillId(AutofillId, long).

When the virtual view hierarchy represents a web page, you should also:

Note: the following methods of the structure will be ignored:

This method will initialize the fields of the ViewStructure using the base implementation in View. On API level 33 and higher, it may also write information about the positions of active views to the extras bundle provided by the ViewStructure. NOTE: When overriding this method on API level 33, if not calling super() or if changing the logic for child views, be sure to provide values for the first active child view position and the list of active child views in the ViewStructure's extras Bundle using the "android.view.ViewStructure.extra.ACTIVE_CHILDREN_IDS" and "android.view.ViewStructure.extra.FIRST_ACTIVE_POSITION" keys.
Parameters
structure ViewStructure: ViewStructure to be filled in with structured view data. This value cannot be null.
flags Int: optional flags.

onRemoteAdapterConnected

Added in API level 11
open fun onRemoteAdapterConnected(): Boolean

Called back when the adapter connects to the RemoteViewsService.

onRemoteAdapterDisconnected

Added in API level 11
open fun onRemoteAdapterDisconnected(): Unit

Called back when the adapter disconnects from the RemoteViewsService.

onResolvePointerIcon

Added in API level 24
open fun onResolvePointerIcon(
    event: MotionEvent!,
    pointerIndex: Int
): PointerIcon!
Parameters
event MotionEvent!: The MotionEvent that requires a pointer icon to be resolved for one of pointers.
pointerIndex Int: The index of the pointer in event for which to retrieve the PointerIcon. This will be between 0 and MotionEvent#getPointerCount().
Return
PointerIcon! the pointer icon to use for specified pointer, or null if a pointer icon is not specified and the default icon should be used.

onRestoreInstanceState

Added in API level 1
open fun onRestoreInstanceState(state: Parcelable!): Unit
Parameters
state Parcelable!: The frozen state that had previously been returned by onSaveInstanceState.

onRtlPropertiesChanged

Added in API level 17
open fun onRtlPropertiesChanged(layoutDirection: Int): Unit
Parameters
layoutDirection Int: the direction of the layout Value is android.view.View#LAYOUT_DIRECTION_LTR, or android.view.View#LAYOUT_DIRECTION_RTL

onSaveInstanceState

Added in API level 1
open fun onSaveInstanceState(): Parcelable?
Return
Parcelable? Returns a Parcelable object containing the view's current dynamic state, or null if there is nothing interesting to save.

onStartNestedScroll

Added in API level 21
open fun onStartNestedScroll(
    child: View,
    target: View,
    nestedScrollAxes: Int
): Boolean
Parameters
child View: Direct child of this ViewParent containing target This value cannot be null.
target View: View that initiated the nested scroll This value cannot be null.
nestedScrollAxes Int: Flags consisting of View#SCROLL_AXIS_HORIZONTAL, View#SCROLL_AXIS_VERTICAL or both
Return
Boolean true if this ViewParent accepts the nested scroll operation

onTextChanged

Added in API level 1
open fun onTextChanged(
    s: CharSequence!,
    start: Int,
    before: Int,
    count: Int
): Unit

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.

onTouchEvent

Added in API level 1
open fun onTouchEvent(ev: MotionEvent!): Boolean
Parameters
event The motion event.
Return
Boolean True if the event was handled, false otherwise.

onTouchModeChanged

Added in API level 1
open fun onTouchModeChanged(isInTouchMode: Boolean): Unit
Parameters
isInTouchMode Boolean: True if the view hierarchy is now in touch mode, false otherwise.

onWindowFocusChanged

Added in API level 1
open fun onWindowFocusChanged(hasWindowFocus: Boolean): Unit
Parameters
hasWindowFocus Boolean: True if the window containing this view now has focus, false otherwise.

performItemClick

Added in API level 1
open fun performItemClick(
    view: View!,
    position: Int,
    id: Long
): Boolean
Parameters
view View!: The view within the AdapterView that was clicked.
position Int: The position of the view in the adapter.
id Long: The row id of the item that was clicked.
Return
Boolean True if there was an assigned OnItemClickListener that was called, false otherwise is returned.

pointToPosition

Added in API level 1
open fun pointToPosition(
    x: Int,
    y: Int
): Int

Maps a point to a position in the list.

Parameters
x Int: X in local coordinate
y Int: Y in local coordinate
Return
Int The position of the item which contains the specified point, or INVALID_POSITION if the point does not intersect an item.

pointToRowId

Added in API level 1
open fun pointToRowId(
    x: Int,
    y: Int
): Long

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

Parameters
x Int: X in local coordinate
y Int: Y in local coordinate
Return
Long The rowId of the item which contains the specified point, or INVALID_ROW_ID if the point does not intersect an item.

reclaimViews

Added in API level 1
open fun reclaimViews(views: MutableList<View!>!): Unit

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.

Parameters
views MutableList<View!>!: A list into which to put the reclaimed views

requestDisallowInterceptTouchEvent

Added in API level 1
open fun requestDisallowInterceptTouchEvent(disallowIntercept: Boolean): Unit
Parameters
disallowIntercept Boolean: True if the child does not want the parent to intercept touch events.

requestLayout

Added in API level 1
open fun requestLayout(): Unit

scrollListBy

Added in API level 19
open fun scrollListBy(y: Int): Unit

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

The actual amount of scroll is capped by the list content viewport height which is the list height minus top and bottom paddings minus one pixel.

Parameters
y Int: the amount of pixels to scroll by vertically

setAdapter

Added in API level 11
open fun setAdapter(adapter: ListAdapter!): Unit

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

Parameters
adapter ListAdapter!: The adapter to use to create this view's content.

setBottomEdgeEffectColor

Added in API level 29
open fun setBottomEdgeEffectColor(color: Int): Unit

Sets the bottom edge effect color.

Parameters
color Int: The color for the bottom edge effect.

setCacheColorHint

Added in API level 1
open fun setCacheColorHint(color: Int): 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. Zero means that what's behind this object is translucent (non solid) or is not made of a single color. This hint will not affect any existing background drawable set on this view ( typically set via setBackgroundDrawable(android.graphics.drawable.Drawable)).

Parameters
color Int: The background color

setChoiceMode

Added in API level 11
open fun setChoiceMode(choiceMode: Int): Unit

Defines the choice behavior for the List. By default, Lists do not have any choice behavior (CHOICE_MODE_NONE). By setting the choiceMode to CHOICE_MODE_SINGLE, the List allows up to one item to be in a chosen state. By setting the choiceMode to CHOICE_MODE_MULTIPLE, the list allows any number of items to be chosen.

Parameters
choiceMode Int: One of CHOICE_MODE_NONE, CHOICE_MODE_SINGLE, or CHOICE_MODE_MULTIPLE

setDrawSelectorOnTop

Added in API level 1
open fun setDrawSelectorOnTop(onTop: Boolean): Unit

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

Parameters
onTop Boolean: If true, the selector will be drawn on the item it is highlighting. The default is false.

setEdgeEffectColor

Added in API level 29
open fun setEdgeEffectColor(color: Int): Unit

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

Parameters
color Int: The color for the edge effects.

setFastScrollAlwaysVisible

Added in API level 11
open fun setFastScrollAlwaysVisible(alwaysShow: Boolean): Unit

Set whether or not the fast scroller should always be shown in place of the standard scroll bars. This will enable fast scrolling if it is not already enabled.

Fast scrollers shown in this way will not fade out and will be a permanent fixture within the list. This is best combined with an inset scroll bar style to ensure the scroll bar does not overlap content.

Parameters
alwaysShow Boolean: true if the fast scroller should always be displayed, false otherwise

setFastScrollEnabled

Added in API level 3
open fun setFastScrollEnabled(enabled: Boolean): Unit

Specifies whether fast scrolling is enabled or disabled.

When fast scrolling is enabled, the user can quickly scroll through lists by dragging the fast scroll thumb.

If the adapter backing this list implements SectionIndexer, the fast scroller will display section header previews as the user scrolls. Additionally, the user will be able to quickly jump between sections by tapping along the length of the scroll bar.

Parameters
enabled Boolean: true to enable fast scrolling, false otherwise

setFastScrollStyle

Added in API level 21
open fun setFastScrollStyle(styleResId: Int): Unit

Specifies the style of the fast scroller decorations.

Parameters
styleResId Int: style resource containing fast scroller properties

setFilterText

Added in API level 1
open fun setFilterText(filterText: String!): Unit

Sets the initial value for the text filter.

Parameters
filterText String!: The text to use for the filter.

setFriction

Added in API level 11
open fun setFriction(friction: Float): Unit

The amount of friction applied to flings. The default value is ViewConfiguration#getScrollFriction.

setItemChecked

Added in API level 11
open fun setItemChecked(
    position: Int,
    value: Boolean
): Unit

Sets the checked state of the specified position. The is only valid if the choice mode has been set to CHOICE_MODE_SINGLE or CHOICE_MODE_MULTIPLE.

Parameters
position Int: The item whose checked state is to be checked
value Boolean: The new checked state for the item

setMultiChoiceModeListener

Added in API level 11
open fun setMultiChoiceModeListener(listener: AbsListView.MultiChoiceModeListener!): Unit

Set a MultiChoiceModeListener that will manage the lifecycle of the selection ActionMode. Only used when the choice mode is set to CHOICE_MODE_MULTIPLE_MODAL.

Parameters
listener AbsListView.MultiChoiceModeListener!: Listener that will manage the selection mode

setOnScrollListener

Added in API level 1
open fun setOnScrollListener(l: AbsListView.OnScrollListener!): Unit

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

Parameters
l AbsListView.OnScrollListener!: the scroll listener

setRecyclerListener

Added in API level 1
open fun setRecyclerListener(listener: AbsListView.RecyclerListener!): Unit

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.

Parameters
listener AbsListView.RecyclerListener!: The recycler listener to be notified of views set aside in the recycler.

setRemoteViewsAdapter

Added in API level 11
open fun setRemoteViewsAdapter(intent: Intent!): Unit

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

Parameters
intent Intent!: the intent used to identify the RemoteViewsService for the adapter to connect to.

setScrollBarStyle

Added in API level 1
open fun setScrollBarStyle(style: Int): Unit
Parameters
style Int: the style of the scrollbars. Should be one of SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_INSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY or SCROLLBARS_OUTSIDE_INSET. Value is android.view.View#SCROLLBARS_INSIDE_OVERLAY, android.view.View#SCROLLBARS_INSIDE_INSET, android.view.View#SCROLLBARS_OUTSIDE_OVERLAY, or android.view.View#SCROLLBARS_OUTSIDE_INSET

setScrollIndicators

Added in API level 1
open fun setScrollIndicators(
    up: View!,
    down: View!
): Unit

setScrollingCacheEnabled

Added in API level 1
open fun setScrollingCacheEnabled(enabled: Boolean): Unit

Enables 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 android.view.ViewGroup#setChildrenDrawingCacheEnabled(boolean).

Parameters
enabled Boolean: true to enable the scroll cache, false otherwise

setSelectedChildViewEnabled

Added in API level 33
open fun setSelectedChildViewEnabled(selectedChildViewEnabled: Boolean): Unit

Set whether the selected child view (from the adapter's getView) is enabled. When refreshDrawableState is called, AbsListView will control the "enabled" state of the selector based on this.

Parameters
selectedChildViewEnabled Boolean: true if enabled

setSelectionFromTop

Added in API level 21
open fun setSelectionFromTop(
    position: Int,
    y: Int
): Unit

Sets the selected item and positions the selection y pixels from the top edge of the ListView. (If in touch mode, the item will not be selected but it will still be positioned appropriately.)

Parameters
position Int: Index (starting at 0) of the data item to be selected.
y Int: The distance from the top edge of the ListView (plus padding) that the item will be positioned.

setSelector

Added in API level 1
open fun setSelector(resID: Int): Unit

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

Parameters
resID Int: A Drawable resource to use as the selection highlight.

setSelector

Added in API level 1
open fun setSelector(sel: Drawable!): Unit

setSmoothScrollbarEnabled

Added in API level 3
open fun setSmoothScrollbarEnabled(enabled: Boolean): 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. 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.

Parameters
enabled Boolean: Whether or not to enable smooth scrollbar.

setStackFromBottom

Added in API level 1
open fun setStackFromBottom(stackFromBottom: Boolean): Unit

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

Parameters
stackFromBottom Boolean: true to pin the view's content to the bottom edge, false to pin the view's content to the top edge

setTextFilterEnabled

Added in API level 1
open fun setTextFilterEnabled(textFilterEnabled: Boolean): Unit

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.

Parameters
textFilterEnabled Boolean: true to enable type filtering, false otherwise

setTopEdgeEffectColor

Added in API level 29
open fun setTopEdgeEffectColor(color: Int): Unit

Sets the top edge effect color.

Parameters
color Int: The color for the top edge effect.

setTranscriptMode

Added in API level 1
open fun setTranscriptMode(mode: Int): Unit

Puts the list or grid into transcript mode. In this mode the list or grid will always scroll to the bottom to show new items.

Parameters
mode Int: the transcript mode to set

setVelocityScale

Added in API level 11
open fun setVelocityScale(scale: Float): Unit

Sets a scale factor for the fling velocity. The initial scale factor is 1.0.

Parameters
scale Float: The scale factor to multiply the velocity by.

setVerticalScrollbarPosition

Added in API level 11
open fun setVerticalScrollbarPosition(position: Int): Unit
Parameters
position Int: Where the vertical scroll bar should be positioned.

showContextMenu

Added in API level 1
open fun showContextMenu(): Boolean
Return
Boolean true if the context menu was shown, false otherwise

showContextMenu

Added in API level 24
open fun showContextMenu(
    x: Float,
    y: Float
): Boolean
Parameters
x Float: the X coordinate in pixels relative to the view to which the menu should be anchored, or Float#NaN to disable anchoring
y Float: the Y coordinate in pixels relative to the view to which the menu should be anchored, or Float#NaN to disable anchoring
Return
Boolean true if the context menu was shown, false otherwise

showContextMenuForChild

Added in API level 1
open fun showContextMenuForChild(originalView: View!): Boolean
Parameters
originalView View!: the source view where the context menu was first invoked
Return
Boolean true if the context menu was shown, false otherwise

showContextMenuForChild

Added in API level 24
open fun showContextMenuForChild(
    originalView: View!,
    x: Float,
    y: Float
): Boolean
Parameters
originalView View!: the source view where the context menu was first invoked
x Float: the X coordinate in pixels relative to the original view to which the menu should be anchored, or Float#NaN to disable anchoring
y Float: the Y coordinate in pixels relative to the original view to which the menu should be anchored, or Float#NaN to disable anchoring
Return
Boolean true if the context menu was shown, false otherwise

smoothScrollBy

Added in API level 8
open fun smoothScrollBy(
    distance: Int,
    duration: Int
): Unit

Smoothly scroll by distance pixels over duration milliseconds.

Parameters
distance Int: Distance to scroll in pixels.
duration Int: Duration of the scroll animation in milliseconds.

smoothScrollToPosition

Added in API level 8
open fun smoothScrollToPosition(position: Int): Unit

Smoothly scroll to the specified adapter position. The view will scroll such that the indicated position is displayed.

Parameters
position Int: Scroll to this adapter position.

smoothScrollToPosition

Added in API level 8
open fun smoothScrollToPosition(
    position: Int,
    boundPosition: Int
): Unit

Smoothly scroll to the specified adapter position. The view will scroll such that the indicated position is displayed, but it will stop early if scrolling further would scroll boundPosition out of view.

Parameters
position Int: Scroll to this adapter position.
boundPosition Int: Do not scroll if it would move this adapter position out of view.

smoothScrollToPositionFromTop

Added in API level 11
open fun smoothScrollToPositionFromTop(
    position: Int,
    offset: Int,
    duration: Int
): Unit

Smoothly scroll to the specified adapter position. The view will scroll such that the indicated position is displayed offset pixels below the top edge of the view. If this is impossible, (e.g. the offset would scroll the first or last item beyond the boundaries of the list) it will get as close as possible. The scroll will take duration milliseconds to complete.

Parameters
position Int: Position to scroll to
offset Int: Desired distance in pixels of position from the top of the view when scrolling is finished
duration Int: Number of milliseconds to use for the scroll

smoothScrollToPositionFromTop

Added in API level 11
open fun smoothScrollToPositionFromTop(
    position: Int,
    offset: Int
): Unit

Smoothly scroll to the specified adapter position. The view will scroll such that the indicated position is displayed offset pixels below the top edge of the view. If this is impossible, (e.g. the offset would scroll the first or last item beyond the boundaries of the list) it will get as close as possible.

Parameters
position Int: Position to scroll to
offset Int: Desired distance in pixels of position from the top of the view when scrolling is finished

verifyDrawable

Added in API level 1
open fun verifyDrawable(dr: Drawable): 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. This allows animations for those drawables to be scheduled.

Be sure to call through to the super class when overriding this function.
If you override this method you must call through to the superclass implementation.

Parameters
who The Drawable to verify. Return true if it is one you are displaying, else return the result of calling through to the super class. This value cannot be null.
dr Drawable: This value cannot be null.
Return
Boolean boolean If true then the Drawable is being displayed in the view; else false and it is not allowed to animate.

Protected methods

checkLayoutParams

Added in API level 1
protected open fun checkLayoutParams(p: ViewGroup.LayoutParams!): Boolean

computeVerticalScrollExtent

Added in API level 1
protected open fun computeVerticalScrollExtent(): Int
Return
Int the vertical extent of the scrollbar's thumb

computeVerticalScrollOffset

Added in API level 1
protected open fun computeVerticalScrollOffset(): Int
Return
Int the vertical offset of the scrollbar's thumb

computeVerticalScrollRange

Added in API level 1
protected open fun computeVerticalScrollRange(): Int
Return
Int the total vertical range represented by the vertical scrollbar

The default range is the drawing height of this view.

dispatchDraw

Added in API level 1
protected open fun dispatchDraw(canvas: Canvas): Unit
Parameters
canvas Canvas: This value cannot be null.

dispatchSetPressed

Added in API level 1
protected open fun dispatchSetPressed(pressed: Boolean): Unit
Parameters
pressed Boolean: The new pressed state

drawableStateChanged

Added in API level 1
protected open fun drawableStateChanged(): Unit

generateDefaultLayoutParams

Added in API level 1
protected open fun generateDefaultLayoutParams(): ViewGroup.LayoutParams!
Return
ViewGroup.LayoutParams! a set of default layout parameters or null

generateLayoutParams

Added in API level 1
protected open fun generateLayoutParams(p: ViewGroup.LayoutParams!): ViewGroup.LayoutParams!
Parameters
p ViewGroup.LayoutParams!: The layout parameters to convert into a suitable set of layout parameters for this ViewGroup.
Return
ViewGroup.LayoutParams! an instance of android.view.ViewGroup.LayoutParams or one of its descendants

getBottomFadingEdgeStrength

Added in API level 1
protected open fun getBottomFadingEdgeStrength(): Float
Return
Float the intensity of the bottom fade as a float between 0.0f and 1.0f

getBottomPaddingOffset

Added in API level 2
protected open fun getBottomPaddingOffset(): Int
Return
Int The bottom padding offset in pixels.

getContextMenuInfo

Added in API level 1
protected open fun getContextMenuInfo(): ContextMenu.ContextMenuInfo!
Return
ContextMenu.ContextMenuInfo! Extra information about the item for which the context menu should be shown. This information will vary across different subclasses of View.

getLeftPaddingOffset

Added in API level 2
protected open fun getLeftPaddingOffset(): Int
Return
Int The left padding offset in pixels.

getRightPaddingOffset

Added in API level 2
protected open fun getRightPaddingOffset(): Int
Return
Int The right padding offset in pixels.

getTopFadingEdgeStrength

Added in API level 1
protected open fun getTopFadingEdgeStrength(): Float
Return
Float the intensity of the top fade as a float between 0.0f and 1.0f

getTopPaddingOffset

Added in API level 2
protected open fun getTopPaddingOffset(): Int
Return
Int The top padding offset in pixels.

handleDataChanged

Added in API level 1
protected open fun handleDataChanged(): Unit

isInFilterMode

Added in API level 1
protected open fun isInFilterMode(): Boolean

isPaddingOffsetRequired

Added in API level 2
protected open fun isPaddingOffsetRequired(): Boolean
Return
Boolean True if padding offset must be applied, false otherwise.

layoutChildren

Added in API level 1
protected open fun layoutChildren(): Unit

Subclasses must override this method to layout their children.

onAttachedToWindow

Added in API level 1
protected open fun onAttachedToWindow(): Unit

onDetachedFromWindow

Added in API level 1
protected open fun onDetachedFromWindow(): Unit

onDisplayHint

Added in API level 8
protected open fun onDisplayHint(hint: Int): Unit
Parameters
hint Int: A hint about whether or not this view is displayed: VISIBLE or INVISIBLE. Value is android.view.View#VISIBLE, android.view.View#INVISIBLE, or android.view.View#GONE

onFocusChanged

Added in API level 1
protected open fun onFocusChanged(
    gainFocus: Boolean,
    direction: Int,
    previouslyFocusedRect: Rect?
): Unit
Parameters
gainFocus Boolean: True if the View has focus; false otherwise.
direction Int: The direction focus has moved when requestFocus() is called to give this view focus. Values are FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_FORWARD, or FOCUS_BACKWARD. It may not always apply, in which case use the default. Value is android.view.View#FOCUS_BACKWARD, android.view.View#FOCUS_FORWARD, android.view.View#FOCUS_LEFT, android.view.View#FOCUS_UP, android.view.View#FOCUS_RIGHT, or android.view.View#FOCUS_DOWN
previouslyFocusedRect Rect?: 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.

onLayout

Added in API level 1
protected open fun onLayout(
    changed: Boolean,
    l: Int,
    t: Int,
    r: Int,
    b: Int
): Unit

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

Parameters
changed Boolean: This is a new size or position for this view
left Left position, relative to parent
top Top position, relative to parent
right Right position, relative to parent
bottom Bottom position, relative to parent

onMeasure

Added in API level 1
protected open fun onMeasure(
    widthMeasureSpec: Int,
    heightMeasureSpec: Int
): Unit
Parameters
widthMeasureSpec Int: horizontal space requirements as imposed by the parent. The requirements are encoded with android.view.View.MeasureSpec.
heightMeasureSpec Int: vertical space requirements as imposed by the parent. The requirements are encoded with android.view.View.MeasureSpec.

onOverScrolled

Added in API level 9
protected open fun onOverScrolled(
    scrollX: Int,
    scrollY: Int,
    clampedX: Boolean,
    clampedY: Boolean
): Unit
Parameters
scrollX Int: New X scroll value in pixels
scrollY Int: New Y scroll value in pixels
clampedX Boolean: True if scrollX was clamped to an over-scroll boundary
clampedY Boolean: True if scrollY was clamped to an over-scroll boundary

onSizeChanged

Added in API level 1
protected open fun onSizeChanged(
    w: Int,
    h: Int,
    oldw: Int,
    oldh: Int
): Unit
Parameters
w Int: Current width of this view.
h Int: Current height of this view.
oldw Int: Old width of this view.
oldh Int: Old height of this view.