Added in API level 1

Spinner


open class Spinner : AbsSpinner, DialogInterface.OnClickListener
kotlin.Any
   ↳ android.view.View
   ↳ android.view.ViewGroup
   ↳ android.widget.AdapterView<android.widget.SpinnerAdapter>
   ↳ android.widget.AbsSpinner
   ↳ android.widget.Spinner

A view that displays one child at a time and lets the user pick among them. The items in the Spinner come from the Adapter associated with this view.

See the Spinners guide.

Summary

XML attributes
android:dropDownHorizontalOffset Amount of pixels by which the drop down should be offset horizontally.
android:dropDownSelector List selector to use for spinnerMode="dropdown" display.
android:dropDownVerticalOffset Amount of pixels by which the drop down should be offset vertically.
android:dropDownWidth Width of the dropdown in spinnerMode="dropdown".
android:gravity Gravity setting for positioning the currently selected item.
android:popupBackground Background drawable to use for the dropdown in spinnerMode="dropdown".
android:prompt The prompt to display when the spinner's dialog is shown.
android:spinnerMode Display mode for spinner options.
Inherited XML attributes
Constants
static Int

Use a dialog window for selecting spinner options.

static Int

Use a dropdown anchored to the Spinner for selecting spinner options.

Inherited constants
Public constructors
Spinner(context: Context!)

Constructs a new spinner with the given context's theme.

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

Constructs a new spinner with the given context's theme and the supplied attribute set.

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

Constructs a new spinner with the given context's theme, the supplied attribute set, and default style attribute.

Spinner(context: Context!, attrs: AttributeSet!, defStyleAttr: Int, mode: Int)

Constructs a new spinner with the given context's theme, the supplied attribute set, and default style attribute.

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

Constructs a new spinner with the given context's theme, the supplied attribute set, and default styles.

Spinner(context: Context!, attrs: AttributeSet!, defStyleAttr: Int, defStyleRes: Int, mode: Int, popupTheme: Resources.Theme!)

Constructs a new spinner with the given context, the supplied attribute set, default styles, popup mode (one of MODE_DIALOG or MODE_DROPDOWN), and the theme against which the popup should be inflated.

Spinner(context: Context!, mode: Int)

Constructs a new spinner with the given context's theme and the supplied mode of displaying choices.

Public methods
open CharSequence!

open Int

open Int

Get the configured horizontal offset in pixels for the spinner's popup window of choices.

open Int

Get the configured vertical offset in pixels for the spinner's popup window of choices.

open Int

Get the configured width of the spinner's popup window of choices in pixels.

open Int

Describes how the selected item view is positioned.

open Drawable!

Get the background drawable for the spinner's popup window of choices.

open Context!

open CharSequence!

open Unit
onClick(dialog: DialogInterface!, which: Int)

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

open Unit

open Parcelable?

open Boolean

open Boolean

open Unit

Sets the SpinnerAdapter used to provide the data which backs this Spinner.

open Unit

Set a horizontal offset in pixels for the spinner's popup window of choices.

open Unit

Set a vertical offset in pixels for the spinner's popup window of choices.

open Unit

Set the width of the spinner's popup window of choices in pixels.

open Unit
setEnabled(enabled: Boolean)

open Unit
setGravity(gravity: Int)

Describes how the selected item view is positioned.

open Unit

A spinner does not support item click events.

open Unit

Set the background drawable for the spinner's popup window of choices.

open Unit

Set the background drawable for the spinner's popup window of choices.

open Unit

Sets the prompt to display when the dialog is shown.

open Unit
setPromptId(promptId: Int)

Sets the prompt to display when the dialog is shown.

Protected methods
open Unit

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

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

Inherited functions