Skip to content

Instantly share code, notes, and snippets.

@noln
Created November 28, 2017 19:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noln/d33e432158a8240d2fb7cd5850092933 to your computer and use it in GitHub Desktop.
Save noln/d33e432158a8240d2fb7cd5850092933 to your computer and use it in GitHub Desktop.
Alert dialog with Spinner in customView, using Anko (Kotlin)
// Items for spinner
val items = arrayOf("One", "Two", "Three", "Four", "Five")
// Alert with a spinner
alert("Example Alert") {
title = "Example Alert"
customView {
verticalLayout {
spinner {
adapter = ArrayAdapter(ctx, android.R.layout.simple_spinner_dropdown_item, countries)
}
}
}
}.show()
@septor
Copy link

septor commented Nov 25, 2018

countries should probably be items, or vice versa.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment