Created
May 12, 2020 04:33
-
-
Save paulproteus/8e96a7f601a5c5818a70bc6d94a88dd8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SNIPPET | |
// Create a Spinner | |
val spinner = Spinner(this, Spinner.MODE_DROPDOWN) | |
val adapter = ArrayAdapter(this, android.R.layout.simple_spinner_item, | |
arrayOf("Option 1", "Option 2", "Option 3")) | |
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item) | |
spinner.adapter = adapter | |
spinner.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED) | |
val spinnerParams = RelativeLayout.LayoutParams(spinner.measuredWidth, spinner.measuredHeight) | |
dynamicLayout.addView(spinner, spinnerParams) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Before click:
After click: