AppCompatSpinner
open class AppCompatSpinner : Spinner, TintableBackgroundView
A Spinner
which supports compatible features on older versions of the platform, including:
- Allows dynamic tint of its background via the background tint methods in
androidx.core.view.ViewCompat
. - Allows setting of the background tint using
R.attr#buttonTint
andR.attr#buttonTintMode
. - Setting the popup theme using
R.attr#popupTheme
.
This will automatically be used when you use Spinner
in your layouts. You should only need to manually use this class when writing custom views.
Summary
Public constructors | |
---|---|
Construct a new spinner with the given context's theme. |
|
Construct a new spinner with the given context's theme and the supplied mode of displaying choices. |
|
<init>(@NonNull context: Context, @Nullable attrs: AttributeSet?) Construct a new spinner with the given context's theme and the supplied attribute set. |
|
<init>(@NonNull context: Context, @Nullable attrs: AttributeSet?, defStyleAttr: Int) Construct a new spinner with the given context's theme, the supplied attribute set, and default style attribute. |
|
<init>(@NonNull context: Context, @Nullable attrs: AttributeSet?, defStyleAttr: Int, mode: Int) Construct a new spinner with the given context's theme, the supplied attribute set, and default style. |
|
<init>(@NonNull context: Context, @Nullable attrs: AttributeSet?, defStyleAttr: Int, mode: Int, popupTheme: Theme!) Constructs a new spinner with the given context's theme, the supplied attribute set, default styles, popup mode (one of |
Public methods | |
---|---|
open Int |
Get the configured horizontal offset in pixels for the spinner's popup window of choices. |
open Int | |
open Int | |
open Drawable! | |
open Context! | |
open CharSequence! | |
open Unit |
onRestoreInstanceState(state: Parcelable!) |
open Parcelable? | |
open Boolean |
onTouchEvent(event: MotionEvent!) |
open Boolean | |
open Unit |
setAdapter(adapter: SpinnerAdapter!) |
open Unit |
setBackgroundDrawable(@Nullable background: Drawable?) |
open Unit |
setBackgroundResource(@DrawableRes resId: Int) |
open Unit |
setDropDownHorizontalOffset(pixels: Int) |
open Unit |
setDropDownVerticalOffset(pixels: Int) |
open Unit |
setDropDownWidth(pixels: Int) |
open Unit |
setPopupBackgroundDrawable(background: Drawable!) |
open Unit |
setPopupBackgroundResource(@DrawableRes resId: Int) |
open Unit |
setPrompt(prompt: CharSequence!) |
Protected methods | |
---|---|
open Unit | |
open Unit | |
open Unit |
Public constructors
<init>
AppCompatSpinner(@NonNull context: Context)
Construct a new spinner with the given context's theme.
Parameters | |
---|---|
context |
Context: The Context the view is running in, through which it can access the current theme, resources, etc. |
<init>
AppCompatSpinner(
@NonNull context: Context,
mode: Int)
Construct a new spinner with the given context's theme and the supplied mode of displaying choices. mode
may be one of MODE_DIALOG
or MODE_DROPDOWN
.
Parameters | |
---|---|
context |
Context: The Context the view is running in, through which it can access the current theme, resources, etc. |
mode |
Int: Constant describing how the user will select choices from the spinner. |
See Also
<init>
AppCompatSpinner(
@NonNull context: Context,
@Nullable attrs: AttributeSet?)
Construct a new spinner with the given context's theme and the supplied attribute set.
Parameters | |
---|---|
context |
Context: The Context the view is running in, through which it can access the current theme, resources, etc. |
attrs |
AttributeSet?: The attributes of the XML tag that is inflating the view. |
<init>
AppCompatSpinner(
@NonNull context: Context,
@Nullable attrs: AttributeSet?,
defStyleAttr: Int)
Construct a new spinner with the given context's theme, the supplied attribute set, and default style attribute.
Parameters | |
---|---|
context |
Context: The Context the view is running in, through which it can access the current theme, resources, etc. |
attrs |
AttributeSet?: The attributes of the XML tag that is inflating the view. |
defStyleAttr |
Int: An attribute in the current theme that contains a reference to a style resource that supplies default values for the view. Can be 0 to not look for defaults. |
<init>
AppCompatSpinner(
@NonNull context: Context,
@Nullable attrs: AttributeSet?,
defStyleAttr: Int,
mode: Int)
Construct a new spinner with the given context's theme, the supplied attribute set, and default style. mode
may be one of MODE_DIALOG
or MODE_DROPDOWN
and determines how the user will select choices from the spinner.
Parameters | |
---|---|
context |
Context: The Context the view is running in, through which it can access the current theme, resources, etc. |
attrs |
AttributeSet?: The attributes of the XML tag that is inflating the view. |
defStyleAttr |
Int: An attribute in the current theme that contains a reference to a style resource that supplies default values for the view. Can be 0 to not look for defaults. |
mode |
Int: Constant describing how the user will select choices from the spinner. |
See Also
<init>
AppCompatSpinner(
@NonNull context: Context,
@Nullable attrs: