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