# ThemedSpinnerAdapter

Added in[API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# ThemedSpinnerAdapter

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/widget/ThemedSpinnerAdapter "View this page in Java")  

```
interface ThemedSpinnerAdapter : SpinnerAdapter
```

|----------------------------------------------------------------------------------------------------------------------------|
| [android.widget.ThemedSpinnerAdapter](https://developer.android.com/reference/kotlin/android/widget/ThemedSpinnerAdapter#) |

|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Known Direct Subclasses [ArrayAdapter](https://developer.android.com/reference/kotlin/android/widget/ArrayAdapter),[CursorAdapter](https://developer.android.com/reference/kotlin/android/widget/CursorAdapter),[SimpleAdapter](https://developer.android.com/reference/kotlin/android/widget/SimpleAdapter) |----------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [ArrayAdapter](https://developer.android.com/reference/kotlin/android/widget/ArrayAdapter)   | You can use this adapter to provide views for an[AdapterView](https://developer.android.com/reference/kotlin/android/widget/AdapterView), Returns a view for each object in a collection of data objects you provide, and can be used with list-based user interface widgets such as[ListView](https://developer.android.com/reference/kotlin/android/widget/ListView)or[Spinner](https://developer.android.com/reference/kotlin/android/widget/Spinner). | | [CursorAdapter](https://developer.android.com/reference/kotlin/android/widget/CursorAdapter) | Adapter that exposes data from a[Cursor](https://developer.android.com/reference/kotlin/android/database/Cursor.html#)to a[ListView](https://developer.android.com/reference/kotlin/android/widget/ListView)widget.                                                                                                                                                                                                                                       | | [SimpleAdapter](https://developer.android.com/reference/kotlin/android/widget/SimpleAdapter) | An easy adapter to map static data to views defined in an XML file.                                                                                                                                                                                                                                                                                                                                                                                       | |

|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Known Indirect Subclasses [ResourceCursorAdapter](https://developer.android.com/reference/kotlin/android/widget/ResourceCursorAdapter),[SimpleCursorAdapter](https://developer.android.com/reference/kotlin/android/widget/SimpleCursorAdapter) |--------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------| | [ResourceCursorAdapter](https://developer.android.com/reference/kotlin/android/widget/ResourceCursorAdapter) | An easy adapter that creates views defined in an XML file.                                      | | [SimpleCursorAdapter](https://developer.android.com/reference/kotlin/android/widget/SimpleCursorAdapter)     | An easy adapter to map columns from a cursor to TextViews or ImageViews defined in an XML file. | |

An extension of SpinnerAdapter that is capable of inflating drop-down views against a different theme than normal views.

Classes that implement this interface should use the theme provided to[setDropDownViewTheme(android.content.res.Resources.Theme)](https://developer.android.com/reference/kotlin/android/widget/ThemedSpinnerAdapter#setDropDownViewTheme(android.content.res.Resources.Theme))when creating views in[SpinnerAdapter.getDropDownView(int, View, ViewGroup)](https://developer.android.com/reference/kotlin/android/widget/SpinnerAdapter#getDropDownView(kotlin.Int,%20android.view.View,%20android.view.ViewGroup)).

## Summary

| Inherited constants ||
|---|---|
| From class[Adapter](https://developer.android.com/reference/kotlin/android/widget/Adapter) |----------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [IGNORE_ITEM_VIEW_TYPE](https://developer.android.com/reference/kotlin/android/widget/Adapter#IGNORE_ITEM_VIEW_TYPE:kotlin.Int) <br /> An item view type that causes the[AdapterView](https://developer.android.com/reference/kotlin/android/widget/AdapterView)to ignore the item view. For example, this can be used if the client does not want a particular view to be given for conversion in[getView(int,android.view.View,android.view.ViewGroup)](https://developer.android.com/reference/kotlin/android/widget/Adapter#getView(kotlin.Int,%20android.view.View,%20android.view.ViewGroup)). <br /> | | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [NO_SELECTION](https://developer.android.com/reference/kotlin/android/widget/Adapter#NO_SELECTION:kotlin.Int) <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | ||

|                                                                                                                                                                                                                                                                                    Public methods                                                                                                                                                                                                                                                                                    ||
|----------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| abstract[Resources.Theme](https://developer.android.com/reference/kotlin/android/content/res/Resources.Theme.html#)? | [getDropDownViewTheme](https://developer.android.com/reference/kotlin/android/widget/ThemedSpinnerAdapter#getDropDownViewTheme())`()` Returns the value previously set by a call to[setDropDownViewTheme(android.content.res.Resources.Theme)](https://developer.android.com/reference/kotlin/android/widget/ThemedSpinnerAdapter#setDropDownViewTheme(android.content.res.Resources.Theme)).                                                                  |
| abstract[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                 | [setDropDownViewTheme](https://developer.android.com/reference/kotlin/android/widget/ThemedSpinnerAdapter#setDropDownViewTheme(android.content.res.Resources.Theme))`(`theme:` `[Resources.Theme](https://developer.android.com/reference/kotlin/android/content/res/Resources.Theme.html#)?`)` Sets the[Resources.Theme](https://developer.android.com/reference/kotlin/android/content/res/Resources.Theme.html#)against which drop-down views are inflated. |

| Inherited functions ||
|---|---|
| From class[Adapter](https://developer.android.com/reference/kotlin/android/widget/Adapter) |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)<[CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)!>? | [getAutofillOptions](https://developer.android.com/reference/kotlin/android/widget/Adapter#getAutofillOptions())`()` <br /> Gets a string representation of the adapter data that can help[android.service.autofill.AutofillService](https://developer.android.com/reference/kotlin/android/service/autofill/AutofillService.html#)autofill the view backed by the adapter. It should only be set (i.e., non-`null`if the values do not represent PII (Personally Identifiable Information - sensitive data such as email addresses, credit card numbers, passwords, etc...). For example, it's ok to return a list of month names, but not a list of usernames. A good rule of thumb is that if the adapter data comes from static resources, such data is not PII - see[android.view.ViewStructure#setDataIsSensitive(boolean)](https://developer.android.com/reference/kotlin/android/view/ViewStructure.html#setDataIsSensitive(kotlin.Boolean))for more info. <br />                                                                        | | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                                                                                                      | [getCount](https://developer.android.com/reference/kotlin/android/widget/Adapter#getCount())`()` <br /> How many items are in the data set represented by this Adapter. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | | [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)!                                                                                                     | [getItem](https://developer.android.com/reference/kotlin/android/widget/Adapter#getItem(kotlin.Int))`(`position:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` <br /> Get the data item associated with the specified position in the data set. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)                                                                                                    | [getItemId](https://developer.android.com/reference/kotlin/android/widget/Adapter#getItemId(kotlin.Int))`(`position:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` <br /> Get the row id associated with the specified position in the list. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                                                                                                      | [getItemViewType](https://developer.android.com/reference/kotlin/android/widget/Adapter#getItemViewType(kotlin.Int))`(`position:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` <br /> Get the type of View that will be created by[getView](https://developer.android.com/reference/kotlin/android/widget/Adapter#getView(kotlin.Int,%20android.view.View,%20android.view.ViewGroup))for the specified item. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | | [View](https://developer.android.com/reference/kotlin/android/view/View.html#)!                                                                                                 | [getView](https://developer.android.com/reference/kotlin/android/widget/Adapter#getView(kotlin.Int,%20android.view.View,%20android.view.ViewGroup))`(`position:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `convertView:` `[View](https://developer.android.com/reference/kotlin/android/view/View.html#)!`, `parent:` `[ViewGroup](https://developer.android.com/reference/kotlin/android/view/ViewGroup.html#)!`)` <br /> Get a View that displays the data at the specified position in the data set. You can either create a View manually or inflate it from an XML layout file. When the View is inflated, the parent View (GridView, ListView...) will apply default layout parameters unless you use[android.view.LayoutInflater#inflate(int, android.view.ViewGroup, boolean)](https://developer.android.com/reference/kotlin/android/view/LayoutInflater.html#inflate(kotlin.Int,%20android.view.ViewGroup,%20kotlin.Boolean))to specify a root view and to prevent attachment to the root. <br /> | | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                                                                                                      | [getViewTypeCount](https://developer.android.com/reference/kotlin/android/widget/Adapter#getViewTypeCount())`()` <br /> Returns the number of types of Views that will be created by[getView](https://developer.android.com/reference/kotlin/android/widget/Adapter#getView(kotlin.Int,%20android.view.View,%20android.view.ViewGroup)). Each type represents a set of views that can be converted in[getView](https://developer.android.com/reference/kotlin/android/widget/Adapter#getView(kotlin.Int,%20android.view.View,%20android.view.ViewGroup)). If the adapter always returns the same type of View for all items, this method should return 1. This method will only be called when the adapter is set on the[AdapterView](https://developer.android.com/reference/kotlin/android/widget/AdapterView). <br />                                                                                                                                                                                                                         | | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                                                                                              | [hasStableIds](https://developer.android.com/reference/kotlin/android/widget/Adapter#hasStableIds())`()` <br /> Indicates whether the item ids are stable across changes to the underlying data. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                                                                                              | [isEmpty](https://developer.android.com/reference/kotlin/android/widget/Adapter#isEmpty())`()` <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                                                    | [registerDataSetObserver](https://developer.android.com/reference/kotlin/android/widget/Adapter#registerDataSetObserver(android.database.DataSetObserver))`(`observer:` `[DataSetObserver](https://developer.android.com/reference/kotlin/android/database/DataSetObserver.html#)!`)` <br /> Register an observer that is called when changes happen to the data used by this adapter. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                                                    | [unregisterDataSetObserver](https://developer.android.com/reference/kotlin/android/widget/Adapter#unregisterDataSetObserver(android.database.DataSetObserver))`(`observer:` `[DataSetObserver](https://developer.android.com/reference/kotlin/android/database/DataSetObserver.html#)!`)` <br /> Unregister an observer that has previously been registered with this adapter via[registerDataSetObserver](https://developer.android.com/reference/kotlin/android/widget/Adapter#registerDataSetObserver(android.database.DataSetObserver)). <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | ||
| From class[SpinnerAdapter](https://developer.android.com/reference/kotlin/android/widget/SpinnerAdapter) |---------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [View](https://developer.android.com/reference/kotlin/android/view/View.html#)! | [getDropDownView](https://developer.android.com/reference/kotlin/android/widget/SpinnerAdapter#getDropDownView(kotlin.Int,%20android.view.View,%20android.view.ViewGroup))`(`position:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `convertView:` `[View](https://developer.android.com/reference/kotlin/android/view/View.html#)!`, `parent:` `[ViewGroup](https://developer.android.com/reference/kotlin/android/view/ViewGroup.html#)!`)` <br /> Gets a[android.view.View](https://developer.android.com/reference/kotlin/android/view/View.html#)that displays in the drop down popup the data at the specified position in the data set. <br /> | ||

## Public methods

### getDropDownViewTheme

Added in[API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
abstract fun getDropDownViewTheme(): Resources.Theme?
```

Returns the value previously set by a call to[setDropDownViewTheme(android.content.res.Resources.Theme)](https://developer.android.com/reference/kotlin/android/widget/ThemedSpinnerAdapter#setDropDownViewTheme(android.content.res.Resources.Theme)).

|                                                                                                                                                       Return                                                                                                                                                       ||
|--------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Resources.Theme](https://developer.android.com/reference/kotlin/android/content/res/Resources.Theme.html#)? | the[Resources.Theme](https://developer.android.com/reference/kotlin/android/content/res/Resources.Theme.html#)against which drop-down views are inflated, or`null`if one has not been explicitly set |

### setDropDownViewTheme

Added in[API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
abstract fun setDropDownViewTheme(theme: Resources.Theme?): Unit
```

Sets the[Resources.Theme](https://developer.android.com/reference/kotlin/android/content/res/Resources.Theme.html#)against which drop-down views are inflated.

|                                                                                                  Parameters                                                                                                  ||
|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `theme` | [Resources.Theme](https://developer.android.com/reference/kotlin/android/content/res/Resources.Theme.html#)?:the context against which to inflate drop-down views, or`null`to use the default theme |

**See Also**

- [android.widget.SpinnerAdapter#getDropDownView(int, View, ViewGroup)](https://developer.android.com/reference/kotlin/android/widget/SpinnerAdapter#getDropDownView(kotlin.Int,%20android.view.View,%20android.view.ViewGroup))