Spinner

class Spinner @JvmOverloads constructor(options: List<String>, selectedOption: String, onItemSelected: (String) -> Unit, style: Style = Style, @ColorInt selectedTextColor: Int = -0x22000000, selectedTextSize: Float = -1f, caret: Drawable? = null, @LayoutRes itemLayout: Int = android.R.layout.simple_dropdown_item_1line) : KComponent

A simple spinner (dropdown) component. Derived from the standard Android android.widget.Spinner

Additionally added logic to flip the caret vertically once menu is shown.

If no optional values are provided the component will look like it's material design counterpart.

Parameters

options

The options available from the dropdown

selectedOption

The initially selected option for the spinner

onItemSelected

The listener for dropdown selections

style

The style for the spinner component

selectedTextColor

The text color of the selected value

selectedTextSize

The text size of the selected value

caret

The spinner caret icon i.e. arrow at the far right. Notice that this drawable will be flipped vertically when the dropdown menu is shown

itemLayout

The item layout for the drop down list android.R.layout.simple_dropdown_item_1line is used by default

Constructors

Link copied to clipboard
constructor(options: List<String>, selectedOption: String, onItemSelected: (String) -> Unit, style: Style = Style, @ColorInt selectedTextColor: Int = -0x22000000, selectedTextSize: Float = -1f, caret: Drawable? = null, @LayoutRes itemLayout: Int = android.R.layout.simple_dropdown_item_1line)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
Link copied to clipboard
operator override fun equals(@Nullable other: Any?): Boolean
Link copied to clipboard
Link copied to clipboard
open fun <T : Any> getDebugAttribute(p0: AttributeKey<T>): T & Any
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
override fun getSimpleName(): String
Link copied to clipboard
fun getTypeId(): Int
Link copied to clipboard
override fun hashCode(): Int
Link copied to clipboard
override fun isEquivalentTo(other: Component?): Boolean
Link copied to clipboard
override fun makeShallowCopy(): Component
Link copied to clipboard
fun measure(p0: ComponentContext, p1: Int, p2: Int, p3: Size)
fun measure(p0: ComponentContext, p1: Int, p2: Int, p3: Size, p4: Boolean)
Link copied to clipboard
open override fun ComponentScope.render(): Component
Link copied to clipboard
Link copied to clipboard
open override fun <T : Any> setDebugAttributeKey(attributeKey: AttributeKey<T>, value: T & Any)
Link copied to clipboard
override fun toString(): String