Added in API level 1

AbsSpinner


abstract class AbsSpinner : AdapterView<SpinnerAdapter!>
kotlin.Any
   ↳ android.view.View
   ↳ android.view.ViewGroup
   ↳ android.widget.AdapterView<android.widget.SpinnerAdapter>
   ↳ android.widget.AbsSpinner

An abstract base class for spinner widgets. SDK users will probably not need to use this class.

Summary

XML attributes
android:entries Reference to an array resource that will populate the Spinner.
Inherited XML attributes
Inherited constants
Public constructors
AbsSpinner(context: Context!)

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

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

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

Public methods
open Unit

open CharSequence!

open SpinnerAdapter!

open Int

Describes the autofill type of this view, so an android.service.autofill.AutofillService can create the proper AutofillValue when autofilling the view.

open AutofillValue?

open Int

open View!

open Unit

open Parcelable?

open Int

Maps a point to a position in the list.

open Unit

Override to prevent spamming ourselves with layout requests as we place views

open Unit

The Adapter is used to provide the data which backs this Spinner.

open Unit
setSelection(position: Int)

open Unit
setSelection(position: Int, animate: Boolean)

Jump directly to a specific item in the adapter data.

Protected methods
open Unit

open ViewGroup.LayoutParams!

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

Inherited functions
Inherited properties

XML attributes

android:entries

android:entries
Reference to an array resource that will populate the Spinner. For static content, this is simpler than populating the Spinner programmatically.

May be a reference to another resource, in the form "@[+][package:]type/name" or a theme attribute in the form "?[package:]type/name".

Public constructors

AbsSpinner

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

AbsSpinner

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

AbsSpinner

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

AbsSpinner

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

Public methods

autofill

Added in API level 26
open fun autofill(value: AutofillValue!): Unit
Parameters
value AutofillValue!: value to be autofilled.

getAccessibilityClassName

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

getAdapter

Added in API level 1
open fun getAdapter(): SpinnerAdapter!
Return
SpinnerAdapter! The adapter used to provide this view's content.

getAutofillType

Added in API level 26
open fun getAutofillType(): Int

Describes the autofill type of this view, so an android.service.autofill.AutofillService can create the proper AutofillValue when autofilling the view.

By default returns AUTOFILL_TYPE_NONE, but views should override it to properly support the Autofill Framework.

Return
Int Value is android.view.View#AUTOFILL_TYPE_NONE, android.view.View#AUTOFILL_TYPE_TEXT, android.view.View#AUTOFILL_TYPE_TOGGLE, android.view.View#AUTOFILL_TYPE_LIST, or android.view.View#AUTOFILL_TYPE_DATE

getAutofillValue

Added in API level 26
open fun getAutofillValue(): AutofillValue?

getCount

Added in API level 1
open fun getCount(): Int
Return
Int The number of items owned by the Adapter associated with this AdapterView. (This is the number of data items, which may be larger than the number of visible views.)

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

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.

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.

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.

requestLayout

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

Override to prevent spamming ourselves with layout requests as we place views

setAdapter

Added in API level 1
open fun setAdapter(adapter: SpinnerAdapter!): Unit

The Adapter is used to provide the data which backs this Spinner. It also provides methods to transform spinner items based on their position relative to the selected item.

Parameters
adapter SpinnerAdapter!: The SpinnerAdapter to use for this Spinner

setSelection

Added in API level 1
open fun setSelection(position: Int): Unit
Parameters
position Int: Index (starting at 0) of the data item to be selected.

setSelection

Added in API level 1
open fun setSelection(
    position: Int,
    animate: Boolean
): Unit

Jump directly to a specific item in the adapter data.

Protected methods

dispatchRestoreInstanceState

Added in API level 1
protected open fun dispatchRestoreInstanceState(container: SparseArray<Parcelable!>!): Unit
Parameters
container SparseArray<Parcelable!>!: The SparseArray which holds previously saved state.

generateDefaultLayoutParams

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

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.